Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(response-structure): add response structure to syntax example #4684

Merged
merged 2 commits into from
May 3, 2023

Conversation

MYoung25
Copy link
Contributor

@MYoung25 MYoung25 commented May 1, 2023

yarn generate-cleints -n for smithy-lang/smithy-typescript#757


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@MYoung25 MYoung25 requested a review from a team as a code owner May 1, 2023 17:13
@MYoung25
Copy link
Contributor Author

MYoung25 commented May 1, 2023

example diff:

diff --git a/clients/client-s3/src/commands/PutObjectCommand.ts b/clients/client-s3/src/commands/PutObjectCommand.ts
index 17de07722d..d1911af9d5 100644
--- a/clients/client-s3/src/commands/PutObjectCommand.ts
+++ b/clients/client-s3/src/commands/PutObjectCommand.ts
@@ -197,6 +197,24 @@ export interface PutObjectCommandOutput extends PutObjectOutput, __MetadataBeare
  * };
  * const command = new PutObjectCommand(input);
  * const response = await client.send(command);
+ * /**
+ * { // PutObjectOutput
+ *   Expiration: "STRING_VALUE",
+ *   ETag: "STRING_VALUE",
+ *   ChecksumCRC32: "STRING_VALUE",
+ *   ChecksumCRC32C: "STRING_VALUE",
+ *   ChecksumSHA1: "STRING_VALUE",
+ *   ChecksumSHA256: "STRING_VALUE",
+ *   ServerSideEncryption: "AES256" || "aws:kms",
+ *   VersionId: "STRING_VALUE",
+ *   SSECustomerAlgorithm: "STRING_VALUE",
+ *   SSECustomerKeyMD5: "STRING_VALUE",
+ *   SSEKMSKeyId: "STRING_VALUE",
+ *   SSEKMSEncryptionContext: "STRING_VALUE",
+ *   BucketKeyEnabled: true || false,
+ *   RequestCharged: "requester",
+ * };
+ *
  * ```
  *
  * @param PutObjectCommandInput - {@link PutObjectCommandInput}
@@ -205,29 +223,8 @@ export interface PutObjectCommandOutput extends PutObjectOutput, __MetadataBeare
  * @see {@link PutObjectCommandOutput} for command's `response` shape.
  * @see {@link S3ClientResolvedConfig | config} for S3Client's `config` shape.
  *
- *
- * @example To upload object and specify user-defined metadata
- * ```javascript
- * // The following example creates an object. The request also specifies optional metadata. If the bucket is versioning enabled, S3 returns version ID in response.
- * const input = {
- *   "Body": "filetoupload",
- *   "Bucket": "examplebucket",
- *   "Key": "exampleobject",
- *   "Metadata": {
- *     "metadata1": "value1",
- *     "metadata2": "value2"
- *   }
- * };
- * const command = new PutObjectCommand(input);
- * const response = await client.send(command);
- * /* response ==
- * {
- *   "ETag": "\"6805f2cfc46c0f04559748bb039d69ae\"",
- *   "VersionId": "pSKidl4pHBiNwukdbcPXAIs.sshFFOc0"
- * }
- * *\/
- * // example id: to-upload-object-and-specify-user-defined-metadata-1483396974757
- * ```
+ * @throws {@link S3ServiceException}
+ * <p>Base exception class for all service exceptions from S3 service.</p>
  *
  * @example To upload an object and specify optional tags
  * ```javascript
@@ -249,62 +246,68 @@ export interface PutObjectCommandOutput extends PutObjectOutput, __MetadataBeare
  * // example id: to-upload-an-object-and-specify-optional-tags-1481762310955
  * ```
  *
- * @example To upload an object and specify canned ACL.
+ * @example To upload an object
  * ```javascript
- * // The following example uploads and object. The request specifies optional canned ACL (access control list) to all READ access to authenticated users. If the bucket is versioning enabled, S3 returns version ID in response.
+ * // The following example uploads an object to a versioning-enabled bucket. The source file is specified using Windows file syntax. S3 returns VersionId of the newly created object.
  * const input = {
- *   "ACL": "authenticated-read",
- *   "Body": "filetoupload",
+ *   "Body": "HappyFace.jpg",
  *   "Bucket": "examplebucket",
- *   "Key": "exampleobject"
+ *   "Key": "HappyFace.jpg"
  * };
  * const command = new PutObjectCommand(input);
  * const response = await client.send(command);
  * /* response ==
  * {
  *   "ETag": "\"6805f2cfc46c0f04559748bb039d69ae\"",
- *   "VersionId": "Kirh.unyZwjQ69YxcQLA8z4F5j3kJJKr"
+ *   "VersionId": "tpf3zF08nBplQK1XLOefGskR7mGDwcDk"
  * }
  * *\/
- * // example id: to-upload-an-object-and-specify-canned-acl-1483397779571
+ * // example id: to-upload-an-object-1481760101010
  * ```
  *
- * @example To create an object.
+ * @example To upload an object and specify server-side encryption and object tags
  * ```javascript
- * // The following example creates an object. If the bucket is versioning enabled, S3 returns version ID in response.
+ * // The following example uploads and object. The request specifies the optional server-side encryption option. The request also specifies optional object tags. If the bucket is versioning enabled, S3 returns version ID in response.
  * const input = {
  *   "Body": "filetoupload",
  *   "Bucket": "examplebucket",
- *   "Key": "objectkey"
+ *   "Key": "exampleobject",
+ *   "ServerSideEncryption": "AES256",
+ *   "Tagging": "key1=value1&key2=value2"
  * };
  * const command = new PutObjectCommand(input);
  * const response = await client.send(command);
  * /* response ==
  * {
  *   "ETag": "\"6805f2cfc46c0f04559748bb039d69ae\"",
- *   "VersionId": "Bvq0EDKxOcXLJXNo_Lkz37eM3R4pfzyQ"
+ *   "ServerSideEncryption": "AES256",
+ *   "VersionId": "Ri.vC6qVlA4dEnjgRV4ZHsHoFIjqEMNt"
  * }
  * *\/
- * // example id: to-create-an-object-1483147613675
+ * // example id: to-upload-an-object-and-specify-server-side-encryption-and-object-tags-1483398331831
  * ```
  *
- * @example To upload an object
+ * @example To upload object and specify user-defined metadata
  * ```javascript
- * // The following example uploads an object to a versioning-enabled bucket. The source file is specified using Windows file syntax. S3 returns VersionId of the newly created object.
+ * // The following example creates an object. The request also specifies optional metadata. If the bucket is versioning enabled, S3 returns version ID in response.
  * const input = {
- *   "Body": "HappyFace.jpg",
+ *   "Body": "filetoupload",
  *   "Bucket": "examplebucket",
- *   "Key": "HappyFace.jpg"
+ *   "Key": "exampleobject",
+ *   "Metadata": {
+ *     "metadata1": "value1",
+ *     "metadata2": "value2"
+ *   }
  * };
  * const command = new PutObjectCommand(input);
  * const response = await client.send(command);
  * /* response ==
  * {
  *   "ETag": "\"6805f2cfc46c0f04559748bb039d69ae\"",
- *   "VersionId": "tpf3zF08nBplQK1XLOefGskR7mGDwcDk"
+ *   "VersionId": "pSKidl4pHBiNwukdbcPXAIs.sshFFOc0"
  * }
  * *\/
- * // example id: to-upload-an-object-1481760101010
+ * // example id: to-upload-object-and-specify-user-defined-metadata-1483396974757
  * ```
  *
  * @example To upload an object (specify optional headers)
@@ -329,26 +332,43 @@ export interface PutObjectCommandOutput extends PutObjectOutput, __MetadataBeare
  * // example id: to-upload-an-object-(specify-optional-headers)
  * ```
  *
- * @example To upload an object and specify server-side encryption and object tags
+ * @example To upload an object and specify canned ACL.
  * ```javascript
- * // The following example uploads an object. The request specifies the optional server-side encryption option. The request also specifies optional object tags. If the bucket is versioning enabled, S3 returns version ID in response.
+ * // The following example uploads and object. The request specifies optional canned ACL (access control list) to all READ access to authenticated users. If the bucket is versioning enabled, S3 returns version ID in response.
  * const input = {
+ *   "ACL": "authenticated-read",
  *   "Body": "filetoupload",
  *   "Bucket": "examplebucket",
- *   "Key": "exampleobject",
- *   "ServerSideEncryption": "AES256",
- *   "Tagging": "key1=value1&key2=value2"
+ *   "Key": "exampleobject"
  * };
  * const command = new PutObjectCommand(input);
  * const response = await client.send(command);
  * /* response ==
  * {
  *   "ETag": "\"6805f2cfc46c0f04559748bb039d69ae\"",
- *   "ServerSideEncryption": "AES256",
- *   "VersionId": "Ri.vC6qVlA4dEnjgRV4ZHsHoFIjqEMNt"
+ *   "VersionId": "Kirh.unyZwjQ69YxcQLA8z4F5j3kJJKr"
  * }
  * *\/
- * // example id: to-upload-an-object-and-specify-server-side-encryption-and-object-tags-1483398331831
+ * // example id: to-upload-an-object-and-specify-canned-acl-1483397779571
+ * ```
+ *
+ * @example To create an object.
+ * ```javascript
+ * // The following example creates an object. If the bucket is versioning enabled, S3 returns version ID in response.
+ * const input = {
+ *   "Body": "filetoupload",
+ *   "Bucket": "examplebucket",
+ *   "Key": "objectkey"
+ * };
+ * const command = new PutObjectCommand(input);
+ * const response = await client.send(command);
+ * /* response ==
+ * {
+ *   "ETag": "\"6805f2cfc46c0f04559748bb039d69ae\"",
+ *   "VersionId": "Bvq0EDKxOcXLJXNo_Lkz37eM3R4pfzyQ"
+ * }
+ * *\/
+ * // example id: to-create-an-object-1483147613675
  * ```
  *
  */

@MYoung25
Copy link
Contributor Author

MYoung25 commented May 1, 2023

diff from last:

diff --git a/clients/client-s3/src/commands/PutObjectCommand.ts b/clients/client-s3/src/commands/PutObjectCommand.ts
index d1911af9d5..aeb8699b9b 100644
--- a/clients/client-s3/src/commands/PutObjectCommand.ts
+++ b/clients/client-s3/src/commands/PutObjectCommand.ts
@@ -197,23 +197,22 @@ export interface PutObjectCommandOutput extends PutObjectOutput, __MetadataBeare
  * };
  * const command = new PutObjectCommand(input);
  * const response = await client.send(command);
- * /**
- * { // PutObjectOutput
- *   Expiration: "STRING_VALUE",
- *   ETag: "STRING_VALUE",
- *   ChecksumCRC32: "STRING_VALUE",
- *   ChecksumCRC32C: "STRING_VALUE",
- *   ChecksumSHA1: "STRING_VALUE",
- *   ChecksumSHA256: "STRING_VALUE",
- *   ServerSideEncryption: "AES256" || "aws:kms",
- *   VersionId: "STRING_VALUE",
- *   SSECustomerAlgorithm: "STRING_VALUE",
- *   SSECustomerKeyMD5: "STRING_VALUE",
- *   SSEKMSKeyId: "STRING_VALUE",
- *   SSEKMSEncryptionContext: "STRING_VALUE",
- *   BucketKeyEnabled: true || false,
- *   RequestCharged: "requester",
- * };
+ * // { // PutObjectOutput
+ * //   Expiration: "STRING_VALUE",
+ * //   ETag: "STRING_VALUE",
+ * //   ChecksumCRC32: "STRING_VALUE",
+ * //   ChecksumCRC32C: "STRING_VALUE",
+ * //   ChecksumSHA1: "STRING_VALUE",
+ * //   ChecksumSHA256: "STRING_VALUE",
+ * //   ServerSideEncryption: "AES256" || "aws:kms",
+ * //   VersionId: "STRING_VALUE",
+ * //   SSECustomerAlgorithm: "STRING_VALUE",
+ * //   SSECustomerKeyMD5: "STRING_VALUE",
+ * //   SSEKMSKeyId: "STRING_VALUE",
+ * //   SSEKMSEncryptionContext: "STRING_VALUE",
+ * //   BucketKeyEnabled: true || false,
+ * //   RequestCharged: "requester",
+ * // };
  *
  * ```
  *

@MYoung25 MYoung25 merged commit 02b68de into aws:main May 3, 2023
@MYoung25 MYoung25 deleted the docs/response-structure branch May 3, 2023 15:57
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants