Skip to content

Commit 830bc72

Browse files
committed
Compact response from AWS CLI, fix arguments according to official docs
1 parent ac91937 commit 830bc72

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/tooling/docs-assembler/Deploying/AwsCloudFrontKeyValueStoreProxy.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void UpdateRedirects(string kvsName, IReadOnlyDictionary<string, string>
4242
ConsoleApp.Log("Describing KeyValueStore");
4343
try
4444
{
45-
var json = Capture("aws", "cloudfront", "describe-key-value-store", "--name", kvsName);
45+
var json = Capture("aws", "cloudfront", "describe-key-value-store", "--name", kvsName, "|", "jq", "-c");
4646
var describeResponse = JsonSerializer.Deserialize<DescribeKeyValueStoreResponse>(json, AwsCloudFrontKeyValueStoreJsonContext.Default.DescribeKeyValueStoreResponse);
4747
if (describeResponse?.ETag is not null && describeResponse.KeyValueStore is { ARN.Length: > 0 })
4848
return (describeResponse.KeyValueStore.ARN, describeResponse.ETag);
@@ -61,13 +61,13 @@ private HashSet<string> ListAllKeys(string kvsArn)
6161
{
6262
ConsoleApp.Log("Acquiring existing redirects");
6363
var allKeys = new HashSet<string>();
64-
string[] baseArgs = ["cloudfront-key-value-store", "list-keys", "--kvs-arn", kvsArn];
64+
string[] baseArgs = ["cloudfront-keyvaluestore", "list-keys", "--kvs-arn", kvsArn];
6565
string? nextToken = null;
6666
try
6767
{
6868
do
6969
{
70-
var json = Capture("aws", [.. baseArgs, .. nextToken is not null ? (string[])["--next-token", nextToken] : []]);
70+
var json = Capture("aws", [.. baseArgs, .. nextToken is not null ? (string[])["--starting-token", nextToken] : [], "|", "jq", "-c"]);
7171
var response = JsonSerializer.Deserialize<ListKeysResponse>(json, AwsCloudFrontKeyValueStoreJsonContext.Default.ListKeysResponse);
7272

7373
if (response?.Items != null)
@@ -108,8 +108,8 @@ private string ProcessBatchUpdates(
108108
AwsCloudFrontKeyValueStoreJsonContext.Default.ListDeleteKeyRequestListItem),
109109
_ => string.Empty
110110
};
111-
var responseJson = Capture(false, 1, "aws", "cloudfront-key-value-store", "update-keys", "--kvs-arn", kvsArn, "--if-match", eTag,
112-
$"--{operation.ToString().ToLowerInvariant()}", "--payload", payload);
111+
var responseJson = Capture(false, 1, "aws", "cloudfront-keyvaluestore", "update-keys", "--kvs-arn", kvsArn, "--if-match", eTag,
112+
$"--{operation.ToString().ToLowerInvariant()}", "--payload", payload, "|", "jq", "-c");
113113
var updateResponse = JsonSerializer.Deserialize<UpdateKeysResponse>(responseJson, AwsCloudFrontKeyValueStoreJsonContext.Default.UpdateKeysResponse);
114114

115115
if (string.IsNullOrEmpty(updateResponse?.ETag))

0 commit comments

Comments
 (0)