Skip to content

Commit e18aaa7

Browse files
authored
docs(clients): add script to write examples for commands (#4486)
* docs(clients): add script to write examples for commands * docs(clients): codegen for command examples
1 parent 60c0e7d commit e18aaa7

File tree

1,217 files changed

+35868
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,217 files changed

+35868
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dist
3333

3434
codegen/**/build
3535
codegen/**/build-single
36+
codegen/sdk-codegen/aws-models-examples
3637
codegen/sdk-codegen/smithy-build.json
3738
codegen/sdk-codegen/smithy-build-*.json
3839
.gradle

clients/client-appconfig/src/commands/CreateApplicationCommand.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,25 @@ export interface CreateApplicationCommandOutput extends Application, __MetadataB
5454
* @see {@link CreateApplicationCommandOutput} for command's `response` shape.
5555
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
5656
*
57+
* @example To create an application
58+
* ```javascript
59+
* // The following create-application example creates an application in AWS AppConfig.
60+
* const input = {
61+
* "Description": "An application used for creating an example.",
62+
* "Name": "example-application"
63+
* };
64+
* const command = new CreateApplicationCommand(input);
65+
* const response = await client.send(command);
66+
* /* response ==
67+
* {
68+
* "Description": "An application used for creating an example.",
69+
* "Id": "339ohji",
70+
* "Name": "example-application"
71+
* }
72+
* *\/
73+
* // example id: to-create-an-application-1632264511615
74+
* ```
75+
*
5776
*/
5877
export class CreateApplicationCommand extends $Command<
5978
CreateApplicationCommandInput,

clients/client-appconfig/src/commands/CreateConfigurationProfileCommand.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,29 @@ export interface CreateConfigurationProfileCommandOutput extends ConfigurationPr
8989
* @see {@link CreateConfigurationProfileCommandOutput} for command's `response` shape.
9090
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
9191
*
92+
* @example To create a configuration profile
93+
* ```javascript
94+
* // The following create-configuration-profile example creates a configuration profile using a configuration stored in Parameter Store, a capability of Systems Manager.
95+
* const input = {
96+
* "ApplicationId": "339ohji",
97+
* "LocationUri": "ssm-parameter://Example-Parameter",
98+
* "Name": "Example-Configuration-Profile",
99+
* "RetrievalRoleArn": "arn:aws:iam::111122223333:role/Example-App-Config-Role"
100+
* };
101+
* const command = new CreateConfigurationProfileCommand(input);
102+
* const response = await client.send(command);
103+
* /* response ==
104+
* {
105+
* "ApplicationId": "339ohji",
106+
* "Id": "ur8hx2f",
107+
* "LocationUri": "ssm-parameter://Example-Parameter",
108+
* "Name": "Example-Configuration-Profile",
109+
* "RetrievalRoleArn": "arn:aws:iam::111122223333:role/Example-App-Config-Role"
110+
* }
111+
* *\/
112+
* // example id: to-create-a-configuration-profile-1632264580336
113+
* ```
114+
*
92115
*/
93116
export class CreateConfigurationProfileCommand extends $Command<
94117
CreateConfigurationProfileCommandInput,

clients/client-appconfig/src/commands/CreateDeploymentStrategyCommand.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,31 @@ export interface CreateDeploymentStrategyCommandOutput extends DeploymentStrateg
5353
* @see {@link CreateDeploymentStrategyCommandOutput} for command's `response` shape.
5454
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
5555
*
56+
* @example To create a deployment strategy
57+
* ```javascript
58+
* // The following create-deployment-strategy example creates a deployment strategy called Example-Deployment that takes 15 minutes and deploys the configuration to 25% of the application at a time. The strategy is also copied to an SSM Document.
59+
* const input = {
60+
* "DeploymentDurationInMinutes": 15,
61+
* "GrowthFactor": 25,
62+
* "Name": "Example-Deployment",
63+
* "ReplicateTo": "SSM_DOCUMENT"
64+
* };
65+
* const command = new CreateDeploymentStrategyCommand(input);
66+
* const response = await client.send(command);
67+
* /* response ==
68+
* {
69+
* "DeploymentDurationInMinutes": 15,
70+
* "FinalBakeTimeInMinutes": 0,
71+
* "GrowthFactor": 25,
72+
* "GrowthType": "LINEAR",
73+
* "Id": "1225qzk",
74+
* "Name": "Example-Deployment",
75+
* "ReplicateTo": "SSM_DOCUMENT"
76+
* }
77+
* *\/
78+
* // example id: to-create-a-deployment-strategy-1632264783812
79+
* ```
80+
*
5681
*/
5782
export class CreateDeploymentStrategyCommand extends $Command<
5883
CreateDeploymentStrategyCommandInput,

clients/client-appconfig/src/commands/CreateEnvironmentCommand.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,26 @@ export interface CreateEnvironmentCommandOutput extends Environment, __MetadataB
5757
* @see {@link CreateEnvironmentCommandOutput} for command's `response` shape.
5858
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
5959
*
60+
* @example To create an environment
61+
* ```javascript
62+
* // The following create-environment example creates an AWS AppConfig environment named Example-Environment using the application you created using create-application
63+
* const input = {
64+
* "ApplicationId": "339ohji",
65+
* "Name": "Example-Environment"
66+
* };
67+
* const command = new CreateEnvironmentCommand(input);
68+
* const response = await client.send(command);
69+
* /* response ==
70+
* {
71+
* "ApplicationId": "339ohji",
72+
* "Id": "54j1r29",
73+
* "Name": "Example-Environment",
74+
* "State": "READY_FOR_DEPLOYMENT"
75+
* }
76+
* *\/
77+
* // example id: to-create-an-environment-1632265124975
78+
* ```
79+
*
6080
*/
6181
export class CreateEnvironmentCommand extends $Command<
6282
CreateEnvironmentCommandInput,

clients/client-appconfig/src/commands/CreateHostedConfigurationVersionCommand.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,29 @@ export interface CreateHostedConfigurationVersionCommandOutput extends HostedCon
5151
* @see {@link CreateHostedConfigurationVersionCommandOutput} for command's `response` shape.
5252
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
5353
*
54+
* @example To create a hosted configuration version
55+
* ```javascript
56+
* // The following create-hosted-configuration-version example creates a new configuration in the AWS AppConfig configuration store.
57+
* const input = {
58+
* "ApplicationId": "339ohji",
59+
* "ConfigurationProfileId": "ur8hx2f",
60+
* "Content": "eyAiTmFtZSI6ICJFeGFtcGxlQXBwbGljYXRpb24iLCAiSWQiOiBFeGFtcGxlSUQsICJSYW5rIjogNyB9",
61+
* "ContentType": "text",
62+
* "LatestVersionNumber": 1
63+
* };
64+
* const command = new CreateHostedConfigurationVersionCommand(input);
65+
* const response = await client.send(command);
66+
* /* response ==
67+
* {
68+
* "ApplicationId": "339ohji",
69+
* "ConfigurationProfileId": "ur8hx2f",
70+
* "ContentType": "text",
71+
* "VersionNumber": 1
72+
* }
73+
* *\/
74+
* // example id: to-create-a-hosted-configuration-version-1632265196980
75+
* ```
76+
*
5477
*/
5578
export class CreateHostedConfigurationVersionCommand extends $Command<
5679
CreateHostedConfigurationVersionCommandInput,

clients/client-appconfig/src/commands/DeleteApplicationCommand.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ export interface DeleteApplicationCommandOutput extends __MetadataBearer {}
4646
* @see {@link DeleteApplicationCommandOutput} for command's `response` shape.
4747
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
4848
*
49+
* @example To delete an application
50+
* ```javascript
51+
* // The following delete-application example deletes the specified application.
52+
* //
53+
* const input = {
54+
* "ApplicationId": "339ohji"
55+
* };
56+
* const command = new DeleteApplicationCommand(input);
57+
* await client.send(command);
58+
* // example id: to-delete-an-application-1632265343951
59+
* ```
60+
*
4961
*/
5062
export class DeleteApplicationCommand extends $Command<
5163
DeleteApplicationCommandInput,

clients/client-appconfig/src/commands/DeleteConfigurationProfileCommand.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ export interface DeleteConfigurationProfileCommandOutput extends __MetadataBeare
4949
* @see {@link DeleteConfigurationProfileCommandOutput} for command's `response` shape.
5050
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
5151
*
52+
* @example To delete a configuration profile
53+
* ```javascript
54+
* // The following delete-configuration-profile example deletes the specified configuration profile.
55+
* const input = {
56+
* "ApplicationId": "339ohji",
57+
* "ConfigurationProfileId": "ur8hx2f"
58+
* };
59+
* const command = new DeleteConfigurationProfileCommand(input);
60+
* await client.send(command);
61+
* // example id: to-delete-a-configuration-profile-1632265401308
62+
* ```
63+
*
5264
*/
5365
export class DeleteConfigurationProfileCommand extends $Command<
5466
DeleteConfigurationProfileCommandInput,

clients/client-appconfig/src/commands/DeleteDeploymentStrategyCommand.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ export interface DeleteDeploymentStrategyCommandOutput extends __MetadataBearer
4646
* @see {@link DeleteDeploymentStrategyCommandOutput} for command's `response` shape.
4747
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
4848
*
49+
* @example To delete a deployment strategy
50+
* ```javascript
51+
* // The following delete-deployment-strategy example deletes the specified deployment strategy.
52+
* const input = {
53+
* "DeploymentStrategyId": "1225qzk"
54+
* };
55+
* const command = new DeleteDeploymentStrategyCommand(input);
56+
* await client.send(command);
57+
* // example id: to-delete-a-deployment-strategy-1632265473708
58+
* ```
59+
*
4960
*/
5061
export class DeleteDeploymentStrategyCommand extends $Command<
5162
DeleteDeploymentStrategyCommandInput,

clients/client-appconfig/src/commands/DeleteEnvironmentCommand.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ export interface DeleteEnvironmentCommandOutput extends __MetadataBearer {}
4646
* @see {@link DeleteEnvironmentCommandOutput} for command's `response` shape.
4747
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
4848
*
49+
* @example To delete an environment
50+
* ```javascript
51+
* // The following delete-environment example deletes the specified application environment.
52+
* const input = {
53+
* "ApplicationId": "339ohji",
54+
* "EnvironmentId": "54j1r29"
55+
* };
56+
* const command = new DeleteEnvironmentCommand(input);
57+
* await client.send(command);
58+
* // example id: to-delete-an-environment-1632265641044
59+
* ```
60+
*
4961
*/
5062
export class DeleteEnvironmentCommand extends $Command<
5163
DeleteEnvironmentCommandInput,

clients/client-appconfig/src/commands/DeleteHostedConfigurationVersionCommand.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ export interface DeleteHostedConfigurationVersionCommandOutput extends __Metadat
4949
* @see {@link DeleteHostedConfigurationVersionCommandOutput} for command's `response` shape.
5050
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
5151
*
52+
* @example To delete a hosted configuration version
53+
* ```javascript
54+
* // The following delete-hosted-configuration-version example deletes a configuration version hosted in the AWS AppConfig configuration store.
55+
* const input = {
56+
* "ApplicationId": "339ohji",
57+
* "ConfigurationProfileId": "ur8hx2f",
58+
* "VersionNumber": 1
59+
* };
60+
* const command = new DeleteHostedConfigurationVersionCommand(input);
61+
* await client.send(command);
62+
* // example id: to-delete-a-hosted-configuration-version-1632265720740
63+
* ```
64+
*
5265
*/
5366
export class DeleteHostedConfigurationVersionCommand extends $Command<
5467
DeleteHostedConfigurationVersionCommandInput,

clients/client-appconfig/src/commands/GetApplicationCommand.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ export interface GetApplicationCommandOutput extends Application, __MetadataBear
5050
* @see {@link GetApplicationCommandOutput} for command's `response` shape.
5151
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
5252
*
53+
* @example To list details of an application
54+
* ```javascript
55+
* // The following get-application example lists the details of the specified application.
56+
* const input = {
57+
* "ApplicationId": "339ohji"
58+
* };
59+
* const command = new GetApplicationCommand(input);
60+
* const response = await client.send(command);
61+
* /* response ==
62+
* {
63+
* "Id": "339ohji",
64+
* "Name": "example-application"
65+
* }
66+
* *\/
67+
* // example id: to-list-details-of-an-application-1632265864702
68+
* ```
69+
*
5370
*/
5471
export class GetApplicationCommand extends $Command<
5572
GetApplicationCommandInput,

clients/client-appconfig/src/commands/GetConfigurationCommand.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,26 @@ export interface GetConfigurationCommandOutput extends Configuration, __Metadata
6666
* @see {@link GetConfigurationCommandOutput} for command's `response` shape.
6767
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
6868
*
69+
* @example To retrieve configuration details
70+
* ```javascript
71+
* // The following get-configuration example returns the configuration details of the example application. On subsequent calls to get-configuration, use the client-configuration-version parameter to only update the configuration of your application if the version has changed. Only updating the configuration when the version has changed avoids excess charges incurred by calling get-configuration.
72+
* const input = {
73+
* "Application": "example-application",
74+
* "ClientId": "example-id",
75+
* "Configuration": "Example-Configuration-Profile",
76+
* "Environment": "Example-Environment"
77+
* };
78+
* const command = new GetConfigurationCommand(input);
79+
* const response = await client.send(command);
80+
* /* response ==
81+
* {
82+
* "ConfigurationVersion": "1",
83+
* "ContentType": "application/octet-stream"
84+
* }
85+
* *\/
86+
* // example id: to-retrieve-configuration-details-1632265954314
87+
* ```
88+
*
6989
*/
7090
export class GetConfigurationCommand extends $Command<
7191
GetConfigurationCommandInput,

clients/client-appconfig/src/commands/GetConfigurationProfileCommand.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,27 @@ export interface GetConfigurationProfileCommandOutput extends ConfigurationProfi
5050
* @see {@link GetConfigurationProfileCommandOutput} for command's `response` shape.
5151
* @see {@link AppConfigClientResolvedConfig | config} for AppConfigClient's `config` shape.
5252
*
53+
* @example To retrieve configuration profile details
54+
* ```javascript
55+
* // The following get-configuration-profile example returns the details of the specified configuration profile.
56+
* const input = {
57+
* "ApplicationId": "339ohji",
58+
* "ConfigurationProfileId": "ur8hx2f"
59+
* };
60+
* const command = new GetConfigurationProfileCommand(input);
61+
* const response = await client.send(command);
62+
* /* response ==
63+
* {
64+
* "ApplicationId": "339ohji",
65+
* "Id": "ur8hx2f",
66+
* "LocationUri": "ssm-parameter://Example-Parameter",
67+
* "Name": "Example-Configuration-Profile",
68+
* "RetrievalRoleArn": "arn:aws:iam::111122223333:role/Example-App-Config-Role"
69+
* }
70+
* *\/
71+
* // example id: to-retrieve-configuration-profile-details-1632266081013
72+
* ```
73+
*
5374
*/
5475
export class GetConfigurationProfileCommand extends $Command<
5576
GetConfigurationProfileCommandInput,

0 commit comments

Comments
 (0)