Update Go AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2019-07-13 00:03:55 +03:00
committed by Andrey Smirnov
parent d08be990ef
commit 94a72b23ff
2183 changed files with 885887 additions and 228114 deletions
+162 -162
View File
@@ -467,16 +467,16 @@ func ExampleS3_DeleteObject_shared01() {
fmt.Println(result)
}
// To remove tag set from an object version
// To remove tag set from an object
//
// The following example removes tag set associated with the specified object version.
// The request specifies both the object key and object version.
// The following example removes tag set associated with the specified object. If the
// bucket is versioning enabled, the operation removes tag set from the latest object
// version.
func ExampleS3_DeleteObjectTagging_shared00() {
svc := s3.New(session.New())
input := &s3.DeleteObjectTaggingInput{
Bucket: aws.String("examplebucket"),
Key: aws.String("HappyFace.jpg"),
VersionId: aws.String("ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI"),
Bucket: aws.String("examplebucket"),
Key: aws.String("HappyFace.jpg"),
}
result, err := svc.DeleteObjectTagging(input)
@@ -497,16 +497,16 @@ func ExampleS3_DeleteObjectTagging_shared00() {
fmt.Println(result)
}
// To remove tag set from an object
// To remove tag set from an object version
//
// The following example removes tag set associated with the specified object. If the
// bucket is versioning enabled, the operation removes tag set from the latest object
// version.
// The following example removes tag set associated with the specified object version.
// The request specifies both the object key and object version.
func ExampleS3_DeleteObjectTagging_shared01() {
svc := s3.New(session.New())
input := &s3.DeleteObjectTaggingInput{
Bucket: aws.String("examplebucket"),
Key: aws.String("HappyFace.jpg"),
Bucket: aws.String("examplebucket"),
Key: aws.String("HappyFace.jpg"),
VersionId: aws.String("ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI"),
}
result, err := svc.DeleteObjectTagging(input)
@@ -1026,14 +1026,16 @@ func ExampleS3_GetObjectAcl_shared00() {
fmt.Println(result)
}
// To retrieve tag set of an object
// To retrieve tag set of a specific object version
//
// The following example retrieves tag set of an object.
// The following example retrieves tag set of an object. The request specifies object
// version.
func ExampleS3_GetObjectTagging_shared00() {
svc := s3.New(session.New())
input := &s3.GetObjectTaggingInput{
Bucket: aws.String("examplebucket"),
Key: aws.String("HappyFace.jpg"),
Bucket: aws.String("examplebucket"),
Key: aws.String("exampleobject"),
VersionId: aws.String("ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI"),
}
result, err := svc.GetObjectTagging(input)
@@ -1054,16 +1056,14 @@ func ExampleS3_GetObjectTagging_shared00() {
fmt.Println(result)
}
// To retrieve tag set of a specific object version
// To retrieve tag set of an object
//
// The following example retrieves tag set of an object. The request specifies object
// version.
// The following example retrieves tag set of an object.
func ExampleS3_GetObjectTagging_shared01() {
svc := s3.New(session.New())
input := &s3.GetObjectTaggingInput{
Bucket: aws.String("examplebucket"),
Key: aws.String("exampleobject"),
VersionId: aws.String("ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI"),
Bucket: aws.String("examplebucket"),
Key: aws.String("HappyFace.jpg"),
}
result, err := svc.GetObjectTagging(input)
@@ -1197,13 +1197,17 @@ func ExampleS3_ListBuckets_shared00() {
fmt.Println(result)
}
// To list in-progress multipart uploads on a bucket
// List next set of multipart uploads when previous result is truncated
//
// The following example lists in-progress multipart uploads on a specific bucket.
// The following example specifies the upload-id-marker and key-marker from previous
// truncated response to retrieve next setup of multipart uploads.
func ExampleS3_ListMultipartUploads_shared00() {
svc := s3.New(session.New())
input := &s3.ListMultipartUploadsInput{
Bucket: aws.String("examplebucket"),
Bucket: aws.String("examplebucket"),
KeyMarker: aws.String("nextkeyfrompreviousresponse"),
MaxUploads: aws.Int64(2),
UploadIdMarker: aws.String("valuefrompreviousresponse"),
}
result, err := svc.ListMultipartUploads(input)
@@ -1224,17 +1228,13 @@ func ExampleS3_ListMultipartUploads_shared00() {
fmt.Println(result)
}
// List next set of multipart uploads when previous result is truncated
// To list in-progress multipart uploads on a bucket
//
// The following example specifies the upload-id-marker and key-marker from previous
// truncated response to retrieve next setup of multipart uploads.
// The following example lists in-progress multipart uploads on a specific bucket.
func ExampleS3_ListMultipartUploads_shared01() {
svc := s3.New(session.New())
input := &s3.ListMultipartUploadsInput{
Bucket: aws.String("examplebucket"),
KeyMarker: aws.String("nextkeyfrompreviousresponse"),
MaxUploads: aws.Int64(2),
UploadIdMarker: aws.String("valuefrompreviousresponse"),
Bucket: aws.String("examplebucket"),
}
result, err := svc.ListMultipartUploads(input)
@@ -1804,45 +1804,12 @@ func ExampleS3_PutBucketWebsite_shared00() {
fmt.Println(result)
}
// To upload an object and specify server-side encryption and object tags
//
// 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.
func ExampleS3_PutObject_shared00() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")),
Bucket: aws.String("examplebucket"),
Key: aws.String("exampleobject"),
ServerSideEncryption: aws.String("AES256"),
Tagging: aws.String("key1=value1&key2=value2"),
}
result, err := svc.PutObject(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To upload an object and specify canned ACL.
//
// 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.
func ExampleS3_PutObject_shared01() {
func ExampleS3_PutObject_shared00() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
ACL: aws.String("authenticated-read"),
@@ -1869,72 +1836,11 @@ func ExampleS3_PutObject_shared01() {
fmt.Println(result)
}
// To upload an object
//
// 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.
func ExampleS3_PutObject_shared02() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(strings.NewReader("HappyFace.jpg")),
Bucket: aws.String("examplebucket"),
Key: aws.String("HappyFace.jpg"),
}
result, err := svc.PutObject(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To create an object.
//
// The following example creates an object. If the bucket is versioning enabled, S3
// returns version ID in response.
func ExampleS3_PutObject_shared03() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")),
Bucket: aws.String("examplebucket"),
Key: aws.String("objectkey"),
}
result, err := svc.PutObject(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To upload an object and specify optional tags
//
// The following example uploads an object. The request specifies optional object tags.
// The bucket is versioned, therefore S3 returns version ID of the newly created object.
func ExampleS3_PutObject_shared04() {
func ExampleS3_PutObject_shared01() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(strings.NewReader("c:\\HappyFace.jpg")),
@@ -1965,7 +1871,7 @@ func ExampleS3_PutObject_shared04() {
//
// The following example creates an object. The request also specifies optional metadata.
// If the bucket is versioning enabled, S3 returns version ID in response.
func ExampleS3_PutObject_shared05() {
func ExampleS3_PutObject_shared02() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")),
@@ -1995,6 +1901,100 @@ func ExampleS3_PutObject_shared05() {
fmt.Println(result)
}
// To upload an object and specify server-side encryption and object tags
//
// 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.
func ExampleS3_PutObject_shared03() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")),
Bucket: aws.String("examplebucket"),
Key: aws.String("exampleobject"),
ServerSideEncryption: aws.String("AES256"),
Tagging: aws.String("key1=value1&key2=value2"),
}
result, err := svc.PutObject(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To create an object.
//
// The following example creates an object. If the bucket is versioning enabled, S3
// returns version ID in response.
func ExampleS3_PutObject_shared04() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")),
Bucket: aws.String("examplebucket"),
Key: aws.String("objectkey"),
}
result, err := svc.PutObject(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To upload an object
//
// 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.
func ExampleS3_PutObject_shared05() {
svc := s3.New(session.New())
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(strings.NewReader("HappyFace.jpg")),
Bucket: aws.String("examplebucket"),
Key: aws.String("HappyFace.jpg"),
}
result, err := svc.PutObject(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To upload an object (specify optional headers)
//
// The following example uploads an object. The request specifies optional request headers
@@ -2171,11 +2171,43 @@ func ExampleS3_UploadPart_shared00() {
fmt.Println(result)
}
// To upload a part by copying data from an existing object as data source
//
// The following example uploads a part of a multipart upload by copying data from an
// existing object as data source.
func ExampleS3_UploadPartCopy_shared00() {
svc := s3.New(session.New())
input := &s3.UploadPartCopyInput{
Bucket: aws.String("examplebucket"),
CopySource: aws.String("/bucketname/sourceobjectkey"),
Key: aws.String("examplelargeobject"),
PartNumber: aws.Int64(1),
UploadId: aws.String("exampleuoh_10OhKhT7YukE9bjzTPRiuaCotmZM_pFngJFir9OZNrSr5cWa3cq3LZSUsfjI4FI7PkP91We7Nrw--"),
}
result, err := svc.UploadPartCopy(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To upload a part by copying byte range from an existing object as data source
//
// The following example uploads a part of a multipart upload by copying a specified
// byte range from an existing object as data source.
func ExampleS3_UploadPartCopy_shared00() {
func ExampleS3_UploadPartCopy_shared01() {
svc := s3.New(session.New())
input := &s3.UploadPartCopyInput{
Bucket: aws.String("examplebucket"),
@@ -2203,35 +2235,3 @@ func ExampleS3_UploadPartCopy_shared00() {
fmt.Println(result)
}
// To upload a part by copying data from an existing object as data source
//
// The following example uploads a part of a multipart upload by copying data from an
// existing object as data source.
func ExampleS3_UploadPartCopy_shared01() {
svc := s3.New(session.New())
input := &s3.UploadPartCopyInput{
Bucket: aws.String("examplebucket"),
CopySource: aws.String("/bucketname/sourceobjectkey"),
Key: aws.String("examplelargeobject"),
PartNumber: aws.Int64(1),
UploadId: aws.String("exampleuoh_10OhKhT7YukE9bjzTPRiuaCotmZM_pFngJFir9OZNrSr5cWa3cq3LZSUsfjI4FI7PkP91We7Nrw--"),
}
result, err := svc.UploadPartCopy(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}