From db3560cfcb9b9074e70026d357f34ca0250b5a9c Mon Sep 17 00:00:00 2001 From: awstools Date: Tue, 13 Aug 2024 18:13:06 +0000 Subject: [PATCH] feat(client-amplify): Add a new field "cacheConfig" that enables users to configure the CDN cache settings for an App --- .../src/commands/CreateAppCommand.ts | 6 ++ .../src/commands/DeleteAppCommand.ts | 3 + .../src/commands/GetAppCommand.ts | 3 + .../src/commands/ListAppsCommand.ts | 3 + .../src/commands/UpdateAppCommand.ts | 6 ++ clients/client-amplify/src/models/models_0.ts | 56 ++++++++++++++++++- .../src/protocols/Aws_restJson1.ts | 8 +++ codegen/sdk-codegen/aws-models/amplify.json | 52 ++++++++++++++++- 8 files changed, 135 insertions(+), 2 deletions(-) diff --git a/clients/client-amplify/src/commands/CreateAppCommand.ts b/clients/client-amplify/src/commands/CreateAppCommand.ts index 1f0f5ff156f4..7425c58017e0 100644 --- a/clients/client-amplify/src/commands/CreateAppCommand.ts +++ b/clients/client-amplify/src/commands/CreateAppCommand.ts @@ -86,6 +86,9 @@ export interface CreateAppCommandOutput extends CreateAppResult, __MetadataBeare * enablePullRequestPreview: true || false, * pullRequestEnvironmentName: "STRING_VALUE", * }, + * cacheConfig: { // CacheConfig + * type: "AMPLIFY_MANAGED" || "AMPLIFY_MANAGED_NO_COOKIES", // required + * }, * }; * const command = new CreateAppCommand(input); * const response = await client.send(command); @@ -146,6 +149,9 @@ export interface CreateAppCommandOutput extends CreateAppResult, __MetadataBeare * // pullRequestEnvironmentName: "STRING_VALUE", * // }, * // repositoryCloneMethod: "SSH" || "TOKEN" || "SIGV4", + * // cacheConfig: { // CacheConfig + * // type: "AMPLIFY_MANAGED" || "AMPLIFY_MANAGED_NO_COOKIES", // required + * // }, * // }, * // }; * diff --git a/clients/client-amplify/src/commands/DeleteAppCommand.ts b/clients/client-amplify/src/commands/DeleteAppCommand.ts index 59b8ee554dff..970842fa0715 100644 --- a/clients/client-amplify/src/commands/DeleteAppCommand.ts +++ b/clients/client-amplify/src/commands/DeleteAppCommand.ts @@ -97,6 +97,9 @@ export interface DeleteAppCommandOutput extends DeleteAppResult, __MetadataBeare * // pullRequestEnvironmentName: "STRING_VALUE", * // }, * // repositoryCloneMethod: "SSH" || "TOKEN" || "SIGV4", + * // cacheConfig: { // CacheConfig + * // type: "AMPLIFY_MANAGED" || "AMPLIFY_MANAGED_NO_COOKIES", // required + * // }, * // }, * // }; * diff --git a/clients/client-amplify/src/commands/GetAppCommand.ts b/clients/client-amplify/src/commands/GetAppCommand.ts index 999e425a4323..ec55b4dfe0c0 100644 --- a/clients/client-amplify/src/commands/GetAppCommand.ts +++ b/clients/client-amplify/src/commands/GetAppCommand.ts @@ -97,6 +97,9 @@ export interface GetAppCommandOutput extends GetAppResult, __MetadataBearer {} * // pullRequestEnvironmentName: "STRING_VALUE", * // }, * // repositoryCloneMethod: "SSH" || "TOKEN" || "SIGV4", + * // cacheConfig: { // CacheConfig + * // type: "AMPLIFY_MANAGED" || "AMPLIFY_MANAGED_NO_COOKIES", // required + * // }, * // }, * // }; * diff --git a/clients/client-amplify/src/commands/ListAppsCommand.ts b/clients/client-amplify/src/commands/ListAppsCommand.ts index a0b9d1366ed9..a21986c6fb2b 100644 --- a/clients/client-amplify/src/commands/ListAppsCommand.ts +++ b/clients/client-amplify/src/commands/ListAppsCommand.ts @@ -99,6 +99,9 @@ export interface ListAppsCommandOutput extends ListAppsResult, __MetadataBearer * // pullRequestEnvironmentName: "STRING_VALUE", * // }, * // repositoryCloneMethod: "SSH" || "TOKEN" || "SIGV4", + * // cacheConfig: { // CacheConfig + * // type: "AMPLIFY_MANAGED" || "AMPLIFY_MANAGED_NO_COOKIES", // required + * // }, * // }, * // ], * // nextToken: "STRING_VALUE", diff --git a/clients/client-amplify/src/commands/UpdateAppCommand.ts b/clients/client-amplify/src/commands/UpdateAppCommand.ts index abe0f8de203a..58d232317d25 100644 --- a/clients/client-amplify/src/commands/UpdateAppCommand.ts +++ b/clients/client-amplify/src/commands/UpdateAppCommand.ts @@ -84,6 +84,9 @@ export interface UpdateAppCommandOutput extends UpdateAppResult, __MetadataBeare * repository: "STRING_VALUE", * oauthToken: "STRING_VALUE", * accessToken: "STRING_VALUE", + * cacheConfig: { // CacheConfig + * type: "AMPLIFY_MANAGED" || "AMPLIFY_MANAGED_NO_COOKIES", // required + * }, * }; * const command = new UpdateAppCommand(input); * const response = await client.send(command); @@ -144,6 +147,9 @@ export interface UpdateAppCommandOutput extends UpdateAppResult, __MetadataBeare * // pullRequestEnvironmentName: "STRING_VALUE", * // }, * // repositoryCloneMethod: "SSH" || "TOKEN" || "SIGV4", + * // cacheConfig: { // CacheConfig + * // type: "AMPLIFY_MANAGED" || "AMPLIFY_MANAGED_NO_COOKIES", // required + * // }, * // }, * // }; * diff --git a/clients/client-amplify/src/models/models_0.ts b/clients/client-amplify/src/models/models_0.ts index bc59a6f703de..da7ac1995253 100644 --- a/clients/client-amplify/src/models/models_0.ts +++ b/clients/client-amplify/src/models/models_0.ts @@ -111,6 +111,40 @@ export interface AutoBranchCreationConfig { pullRequestEnvironmentName?: string; } +/** + * @public + * @enum + */ +export const CacheConfigType = { + AMPLIFY_MANAGED: "AMPLIFY_MANAGED", + AMPLIFY_MANAGED_NO_COOKIES: "AMPLIFY_MANAGED_NO_COOKIES", +} as const; + +/** + * @public + */ +export type CacheConfigType = (typeof CacheConfigType)[keyof typeof CacheConfigType]; + +/** + *

Describes the cache configuration for an Amplify app.

+ *

For more + * information about how Amplify applies an optimal cache configuration for + * your app based on the type of content that is being served, see Managing cache configuration in the Amplify User + * guide.

+ * @public + */ +export interface CacheConfig { + /** + *

The type of cache configuration to use for an Amplify app.

+ *

The AMPLIFY_MANAGED cache configuration automatically applies an + * optimized cache configuration for your app based on its platform, routing rules, and + * rewrite rules. This is the default setting.

+ *

The AMPLIFY_MANAGED_NO_COOKIES cache configuration type is the same as AMPLIFY_MANAGED, except that it excludes all cookies from the cache key.

+ * @public + */ + type: CacheConfigType | undefined; +} + /** *

Describes a custom rewrite or redirect rule.

* @public @@ -329,6 +363,12 @@ export interface CreateAppRequest { * @public */ autoBranchCreationConfig?: AutoBranchCreationConfig; + + /** + *

The cache configuration for the Amplify app.

+ * @public + */ + cacheConfig?: CacheConfig; } /** @@ -543,6 +583,14 @@ export interface App { * @public */ repositoryCloneMethod?: RepositoryCloneMethod; + + /** + *

The cache configuration for the Amplify app. If you don't specify the + * cache configuration type, Amplify uses the default + * AMPLIFY_MANAGED setting.

+ * @public + */ + cacheConfig?: CacheConfig; } /** @@ -1278,7 +1326,7 @@ export interface Certificate { * import) the certificate in the US East (N. Virginia) Region (us-east-1). For more * information about using ACM, see Importing certificates into * Certificate Manager in the ACM User - * guide .

+ * guide.

* @public */ type: CertificateType | undefined; @@ -2937,6 +2985,12 @@ export interface UpdateAppRequest { * @public */ accessToken?: string; + + /** + *

The cache configuration for the Amplify app.

+ * @public + */ + cacheConfig?: CacheConfig; } /** diff --git a/clients/client-amplify/src/protocols/Aws_restJson1.ts b/clients/client-amplify/src/protocols/Aws_restJson1.ts index 4270f17942d5..a53f09838bd0 100644 --- a/clients/client-amplify/src/protocols/Aws_restJson1.ts +++ b/clients/client-amplify/src/protocols/Aws_restJson1.ts @@ -99,6 +99,7 @@ import { BackendEnvironment, BadRequestException, Branch, + CacheConfig, CertificateSettings, CustomRule, DependentServiceFailureException, @@ -135,6 +136,7 @@ export const se_CreateAppCommand = async ( autoBranchCreationPatterns: (_) => _json(_), basicAuthCredentials: [], buildSpec: [], + cacheConfig: (_) => _json(_), customHeaders: [], customRules: (_) => _json(_), description: [], @@ -830,6 +832,7 @@ export const se_UpdateAppCommand = async ( autoBranchCreationPatterns: (_) => _json(_), basicAuthCredentials: [], buildSpec: [], + cacheConfig: (_) => _json(_), customHeaders: [], customRules: (_) => _json(_), description: [], @@ -1904,6 +1907,8 @@ const de_UnauthorizedExceptionRes = async ( // se_Backend omitted. +// se_CacheConfig omitted. + // se_CertificateSettings omitted. // se_CustomRule omitted. @@ -1931,6 +1936,7 @@ const de_App = (output: any, context: __SerdeContext): App => { autoBranchCreationPatterns: _json, basicAuthCredentials: __expectString, buildSpec: __expectString, + cacheConfig: _json, createTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), customHeaders: __expectString, customRules: _json, @@ -2052,6 +2058,8 @@ const de_Branches = (output: any, context: __SerdeContext): Branch[] => { return retVal; }; +// de_CacheConfig omitted. + // de_Certificate omitted. // de_CustomDomains omitted. diff --git a/codegen/sdk-codegen/aws-models/amplify.json b/codegen/sdk-codegen/aws-models/amplify.json index c0be344d41e5..34bab28a6eea 100644 --- a/codegen/sdk-codegen/aws-models/amplify.json +++ b/codegen/sdk-codegen/aws-models/amplify.json @@ -1204,6 +1204,12 @@ "traits": { "smithy.api#documentation": "\n

This is for internal use.

\n
\n

The Amplify service uses this parameter to specify the authentication protocol to use\n to access the Git repository for an Amplify app. Amplify specifies TOKEN\n for a GitHub repository, SIGV4 for an Amazon Web Services CodeCommit\n repository, and SSH for GitLab and Bitbucket repositories.

" } + }, + "cacheConfig": { + "target": "com.amazonaws.amplify#CacheConfig", + "traits": { + "smithy.api#documentation": "

The cache configuration for the Amplify app. If you don't specify the\n cache configuration type, Amplify uses the default\n AMPLIFY_MANAGED setting.

" + } } }, "traits": { @@ -1761,13 +1767,45 @@ "smithy.api#sensitive": {} } }, + "com.amazonaws.amplify#CacheConfig": { + "type": "structure", + "members": { + "type": { + "target": "com.amazonaws.amplify#CacheConfigType", + "traits": { + "smithy.api#documentation": "

The type of cache configuration to use for an Amplify app.

\n

The AMPLIFY_MANAGED cache configuration automatically applies an\n optimized cache configuration for your app based on its platform, routing rules, and\n rewrite rules. This is the default setting.

\n

The AMPLIFY_MANAGED_NO_COOKIES cache configuration type is the same as AMPLIFY_MANAGED, except that it excludes all cookies from the cache key.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Describes the cache configuration for an Amplify app.

\n

For more\n information about how Amplify applies an optimal cache configuration for\n your app based on the type of content that is being served, see Managing cache configuration in the Amplify User\n guide.

" + } + }, + "com.amazonaws.amplify#CacheConfigType": { + "type": "enum", + "members": { + "AMPLIFY_MANAGED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "AMPLIFY_MANAGED" + } + }, + "AMPLIFY_MANAGED_NO_COOKIES": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "AMPLIFY_MANAGED_NO_COOKIES" + } + } + } + }, "com.amazonaws.amplify#Certificate": { "type": "structure", "members": { "type": { "target": "com.amazonaws.amplify#CertificateType", "traits": { - "smithy.api#documentation": "

The type of SSL/TLS certificate that you want to use.

\n

Specify AMPLIFY_MANAGED to use the default certificate that Amplify\n provisions for you.

\n

Specify CUSTOM to use your own certificate that you have already added to\n Certificate Manager in your Amazon Web Services account. Make sure you request (or\n import) the certificate in the US East (N. Virginia) Region (us-east-1). For more\n information about using ACM, see Importing certificates into\n Certificate Manager in the ACM User\n guide .

", + "smithy.api#documentation": "

The type of SSL/TLS certificate that you want to use.

\n

Specify AMPLIFY_MANAGED to use the default certificate that Amplify\n provisions for you.

\n

Specify CUSTOM to use your own certificate that you have already added to\n Certificate Manager in your Amazon Web Services account. Make sure you request (or\n import) the certificate in the US East (N. Virginia) Region (us-east-1). For more\n information about using ACM, see Importing certificates into\n Certificate Manager in the ACM User\n guide.

", "smithy.api#required": {} } }, @@ -2035,6 +2073,12 @@ "traits": { "smithy.api#documentation": "

The automated branch creation configuration for an Amplify app.

" } + }, + "cacheConfig": { + "target": "com.amazonaws.amplify#CacheConfig", + "traits": { + "smithy.api#documentation": "

The cache configuration for the Amplify app.

" + } } }, "traits": { @@ -6161,6 +6205,12 @@ "traits": { "smithy.api#documentation": "

The personal access token for a GitHub repository for an Amplify app. The personal\n access token is used to authorize access to a GitHub repository using the Amplify GitHub\n App. The token is not stored.

\n

Use accessToken for GitHub repositories only. To authorize access to a\n repository provider such as Bitbucket or CodeCommit, use oauthToken.

\n

You must specify either accessToken or oauthToken when you\n update an app.

\n

Existing Amplify apps deployed from a GitHub repository using OAuth continue to work\n with CI/CD. However, we strongly recommend that you migrate these apps to use the GitHub\n App. For more information, see Migrating an existing OAuth app to the Amplify GitHub App in the\n Amplify User Guide .

" } + }, + "cacheConfig": { + "target": "com.amazonaws.amplify#CacheConfig", + "traits": { + "smithy.api#documentation": "

The cache configuration for the Amplify app.

" + } } }, "traits": {