Skip to content

Commit

Permalink
feat(client-amplify): Add a new field "cacheConfig" that enables user…
Browse files Browse the repository at this point in the history
…s to configure the CDN cache settings for an App
  • Loading branch information
awstools committed Aug 13, 2024
1 parent 223369d commit db3560c
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 2 deletions.
6 changes: 6 additions & 0 deletions clients/client-amplify/src/commands/CreateAppCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
* // },
* // },
* // };
*
Expand Down
3 changes: 3 additions & 0 deletions clients/client-amplify/src/commands/DeleteAppCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* // },
* // },
* // };
*
Expand Down
3 changes: 3 additions & 0 deletions clients/client-amplify/src/commands/GetAppCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* // },
* // },
* // };
*
Expand Down
3 changes: 3 additions & 0 deletions clients/client-amplify/src/commands/ListAppsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions clients/client-amplify/src/commands/UpdateAppCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
* // },
* // },
* // };
*
Expand Down
56 changes: 55 additions & 1 deletion clients/client-amplify/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];

/**
* <p>Describes the cache configuration for an Amplify app.</p>
* <p>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 <a href="https://docs.aws.amazon.com/amplify/latest/userguide/managing-cache-configuration">Managing cache configuration</a> in the <i>Amplify User
* guide</i>.</p>
* @public
*/
export interface CacheConfig {
/**
* <p>The type of cache configuration to use for an Amplify app.</p>
* <p>The <code>AMPLIFY_MANAGED</code> 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.</p>
* <p>The <code>AMPLIFY_MANAGED_NO_COOKIES</code> cache configuration type is the same as <code>AMPLIFY_MANAGED</code>, except that it excludes all cookies from the cache key.</p>
* @public
*/
type: CacheConfigType | undefined;
}

/**
* <p>Describes a custom rewrite or redirect rule. </p>
* @public
Expand Down Expand Up @@ -329,6 +363,12 @@ export interface CreateAppRequest {
* @public
*/
autoBranchCreationConfig?: AutoBranchCreationConfig;

/**
* <p>The cache configuration for the Amplify app.</p>
* @public
*/
cacheConfig?: CacheConfig;
}

/**
Expand Down Expand Up @@ -543,6 +583,14 @@ export interface App {
* @public
*/
repositoryCloneMethod?: RepositoryCloneMethod;

/**
* <p>The cache configuration for the Amplify app. If you don't specify the
* cache configuration <code>type</code>, Amplify uses the default
* <code>AMPLIFY_MANAGED</code> setting.</p>
* @public
*/
cacheConfig?: CacheConfig;
}

/**
Expand Down Expand Up @@ -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 <a href="https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html">Importing certificates into
* Certificate Manager</a> in the <i>ACM User
* guide</i> .</p>
* guide</i>.</p>
* @public
*/
type: CertificateType | undefined;
Expand Down Expand Up @@ -2937,6 +2985,12 @@ export interface UpdateAppRequest {
* @public
*/
accessToken?: string;

/**
* <p>The cache configuration for the Amplify app.</p>
* @public
*/
cacheConfig?: CacheConfig;
}

/**
Expand Down
8 changes: 8 additions & 0 deletions clients/client-amplify/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ import {
BackendEnvironment,
BadRequestException,
Branch,
CacheConfig,
CertificateSettings,
CustomRule,
DependentServiceFailureException,
Expand Down Expand Up @@ -135,6 +136,7 @@ export const se_CreateAppCommand = async (
autoBranchCreationPatterns: (_) => _json(_),
basicAuthCredentials: [],
buildSpec: [],
cacheConfig: (_) => _json(_),
customHeaders: [],
customRules: (_) => _json(_),
description: [],
Expand Down Expand Up @@ -830,6 +832,7 @@ export const se_UpdateAppCommand = async (
autoBranchCreationPatterns: (_) => _json(_),
basicAuthCredentials: [],
buildSpec: [],
cacheConfig: (_) => _json(_),
customHeaders: [],
customRules: (_) => _json(_),
description: [],
Expand Down Expand Up @@ -1904,6 +1907,8 @@ const de_UnauthorizedExceptionRes = async (

// se_Backend omitted.

// se_CacheConfig omitted.

// se_CertificateSettings omitted.

// se_CustomRule omitted.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -2052,6 +2058,8 @@ const de_Branches = (output: any, context: __SerdeContext): Branch[] => {
return retVal;
};

// de_CacheConfig omitted.

// de_Certificate omitted.

// de_CustomDomains omitted.
Expand Down
52 changes: 51 additions & 1 deletion codegen/sdk-codegen/aws-models/amplify.json
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,12 @@
"traits": {
"smithy.api#documentation": "<note>\n <p>This is for internal use.</p>\n </note>\n <p>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 <code>TOKEN</code>\n for a GitHub repository, <code>SIGV4</code> for an Amazon Web Services CodeCommit\n repository, and <code>SSH</code> for GitLab and Bitbucket repositories.</p>"
}
},
"cacheConfig": {
"target": "com.amazonaws.amplify#CacheConfig",
"traits": {
"smithy.api#documentation": "<p>The cache configuration for the Amplify app. If you don't specify the\n cache configuration <code>type</code>, Amplify uses the default\n <code>AMPLIFY_MANAGED</code> setting.</p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -1761,13 +1767,45 @@
"smithy.api#sensitive": {}
}
},
"com.amazonaws.amplify#CacheConfig": {
"type": "structure",
"members": {
"type": {
"target": "com.amazonaws.amplify#CacheConfigType",
"traits": {
"smithy.api#documentation": "<p>The type of cache configuration to use for an Amplify app.</p>\n <p>The <code>AMPLIFY_MANAGED</code> 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.</p>\n <p>The <code>AMPLIFY_MANAGED_NO_COOKIES</code> cache configuration type is the same as <code>AMPLIFY_MANAGED</code>, except that it excludes all cookies from the cache key.</p>",
"smithy.api#required": {}
}
}
},
"traits": {
"smithy.api#documentation": "<p>Describes the cache configuration for an Amplify app.</p>\n <p>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 <a href=\"https://docs.aws.amazon.com/amplify/latest/userguide/managing-cache-configuration\">Managing cache configuration</a> in the <i>Amplify User\n guide</i>.</p>"
}
},
"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": "<p>The type of SSL/TLS certificate that you want to use.</p>\n <p>Specify <code>AMPLIFY_MANAGED</code> to use the default certificate that Amplify\n provisions for you.</p>\n <p>Specify <code>CUSTOM</code> 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 <a href=\"https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html\">Importing certificates into\n Certificate Manager</a> in the <i>ACM User\n guide</i> .</p>",
"smithy.api#documentation": "<p>The type of SSL/TLS certificate that you want to use.</p>\n <p>Specify <code>AMPLIFY_MANAGED</code> to use the default certificate that Amplify\n provisions for you.</p>\n <p>Specify <code>CUSTOM</code> 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 <a href=\"https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html\">Importing certificates into\n Certificate Manager</a> in the <i>ACM User\n guide</i>.</p>",
"smithy.api#required": {}
}
},
Expand Down Expand Up @@ -2035,6 +2073,12 @@
"traits": {
"smithy.api#documentation": "<p>The automated branch creation configuration for an Amplify app. </p>"
}
},
"cacheConfig": {
"target": "com.amazonaws.amplify#CacheConfig",
"traits": {
"smithy.api#documentation": "<p>The cache configuration for the Amplify app.</p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -6161,6 +6205,12 @@
"traits": {
"smithy.api#documentation": "<p>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.</p>\n <p>Use <code>accessToken</code> for GitHub repositories only. To authorize access to a\n repository provider such as Bitbucket or CodeCommit, use <code>oauthToken</code>.</p>\n <p>You must specify either <code>accessToken</code> or <code>oauthToken</code> when you\n update an app.</p>\n <p>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 <a href=\"https://docs.aws.amazon.com/amplify/latest/userguide/setting-up-GitHub-access.html#migrating-to-github-app-auth\">Migrating an existing OAuth app to the Amplify GitHub App</a> in the\n <i>Amplify User Guide</i> .</p>"
}
},
"cacheConfig": {
"target": "com.amazonaws.amplify#CacheConfig",
"traits": {
"smithy.api#documentation": "<p>The cache configuration for the Amplify app.</p>"
}
}
},
"traits": {
Expand Down

0 comments on commit db3560c

Please sign in to comment.