// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.

package s3_test

import (
	"context"
	"fmt"
	"strings"
	"time"

	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/aws-sdk-go-v2/aws/awserr"
	"github.com/aws/aws-sdk-go-v2/aws/external"
	"github.com/aws/aws-sdk-go-v2/service/s3"
)

var _ time.Duration
var _ strings.Reader
var _ aws.Config

func parseTime(layout, value string) *time.Time {
	t, err := time.Parse(layout, value)
	if err != nil {
		panic(err)
	}
	return &t
}

// To abort a multipart upload
//
// The following example aborts a multipart upload.
func ExampleClient_AbortMultipartUploadRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.AbortMultipartUploadInput{
		Bucket:   aws.String("examplebucket"),
		Key:      aws.String("bigobject"),
		UploadId: aws.String("xadcOB_7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--"),
	}

	req := svc.AbortMultipartUploadRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeNoSuchUpload:
				fmt.Println(s3.ErrCodeNoSuchUpload, aerr.Error())
			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 complete multipart upload
//
// The following example completes a multipart upload.
func ExampleClient_CompleteMultipartUploadRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.CompleteMultipartUploadInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("bigobject"),
		MultipartUpload: &s3.CompletedMultipartUpload{
			Parts: []s3.CompletedPart{
				{
					ETag:       aws.String("\"d8c2eafd90c266e19ab9dcacc479f8af\""),
					PartNumber: aws.Int64(1),
				},
				{
					ETag:       aws.String("\"d8c2eafd90c266e19ab9dcacc479f8af\""),
					PartNumber: aws.Int64(2),
				},
			},
		},
		UploadId: aws.String("7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--"),
	}

	req := svc.CompleteMultipartUploadRequest(input)
	result, err := req.Send(context.Background())
	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 copy an object
//
// The following example copies an object from one bucket to another.
func ExampleClient_CopyObjectRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.CopyObjectInput{
		Bucket:     aws.String("destinationbucket"),
		CopySource: aws.String("/sourcebucket/HappyFacejpg"),
		Key:        aws.String("HappyFaceCopyjpg"),
	}

	req := svc.CopyObjectRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeObjectNotInActiveTierError:
				fmt.Println(s3.ErrCodeObjectNotInActiveTierError, aerr.Error())
			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 a bucket
//
// The following example creates a bucket.
func ExampleClient_CreateBucketRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.CreateBucketInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.CreateBucketRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeBucketAlreadyExists:
				fmt.Println(s3.ErrCodeBucketAlreadyExists, aerr.Error())
			case s3.ErrCodeBucketAlreadyOwnedByYou:
				fmt.Println(s3.ErrCodeBucketAlreadyOwnedByYou, aerr.Error())
			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 a bucket in a specific region
//
// The following example creates a bucket. The request specifies an AWS region where
// to create the bucket.
func ExampleClient_CreateBucketRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.CreateBucketInput{
		Bucket: aws.String("examplebucket"),
		CreateBucketConfiguration: &s3.CreateBucketConfiguration{
			LocationConstraint: s3.BucketLocationConstraintEuWest1,
		},
	}

	req := svc.CreateBucketRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeBucketAlreadyExists:
				fmt.Println(s3.ErrCodeBucketAlreadyExists, aerr.Error())
			case s3.ErrCodeBucketAlreadyOwnedByYou:
				fmt.Println(s3.ErrCodeBucketAlreadyOwnedByYou, aerr.Error())
			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 initiate a multipart upload
//
// The following example initiates a multipart upload.
func ExampleClient_CreateMultipartUploadRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.CreateMultipartUploadInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("largeobject"),
	}

	req := svc.CreateMultipartUploadRequest(input)
	result, err := req.Send(context.Background())
	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 delete a bucket
//
// The following example deletes the specified bucket.
func ExampleClient_DeleteBucketRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteBucketInput{
		Bucket: aws.String("forrandall2"),
	}

	req := svc.DeleteBucketRequest(input)
	result, err := req.Send(context.Background())
	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 delete cors configuration on a bucket.
//
// The following example deletes CORS configuration on a bucket.
func ExampleClient_DeleteBucketCorsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteBucketCorsInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.DeleteBucketCorsRequest(input)
	result, err := req.Send(context.Background())
	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 delete lifecycle configuration on a bucket.
//
// The following example deletes lifecycle configuration on a bucket.
func ExampleClient_DeleteBucketLifecycleRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteBucketLifecycleInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.DeleteBucketLifecycleRequest(input)
	result, err := req.Send(context.Background())
	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 delete bucket policy
//
// The following example deletes bucket policy on the specified bucket.
func ExampleClient_DeleteBucketPolicyRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteBucketPolicyInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.DeleteBucketPolicyRequest(input)
	result, err := req.Send(context.Background())
	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 delete bucket replication configuration
//
// The following example deletes replication configuration set on bucket.
func ExampleClient_DeleteBucketReplicationRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteBucketReplicationInput{
		Bucket: aws.String("example"),
	}

	req := svc.DeleteBucketReplicationRequest(input)
	result, err := req.Send(context.Background())
	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 delete bucket tags
//
// The following example deletes bucket tags.
func ExampleClient_DeleteBucketTaggingRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteBucketTaggingInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.DeleteBucketTaggingRequest(input)
	result, err := req.Send(context.Background())
	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 delete bucket website configuration
//
// The following example deletes bucket website configuration.
func ExampleClient_DeleteBucketWebsiteRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteBucketWebsiteInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.DeleteBucketWebsiteRequest(input)
	result, err := req.Send(context.Background())
	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 delete an object
//
// The following example deletes an object from an S3 bucket.
func ExampleClient_DeleteObjectRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteObjectInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("objectkey.jpg"),
	}

	req := svc.DeleteObjectRequest(input)
	result, err := req.Send(context.Background())
	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 delete an object (from a non-versioned bucket)
//
// The following example deletes an object from a non-versioned bucket.
func ExampleClient_DeleteObjectRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteObjectInput{
		Bucket: aws.String("ExampleBucket"),
		Key:    aws.String("HappyFace.jpg"),
	}

	req := svc.DeleteObjectRequest(input)
	result, err := req.Send(context.Background())
	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 remove tag set from an object
//
// 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 ExampleClient_DeleteObjectTaggingRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteObjectTaggingInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("HappyFace.jpg"),
	}

	req := svc.DeleteObjectTaggingRequest(input)
	result, err := req.Send(context.Background())
	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 remove tag set from an 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 ExampleClient_DeleteObjectTaggingRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteObjectTaggingInput{
		Bucket:    aws.String("examplebucket"),
		Key:       aws.String("HappyFace.jpg"),
		VersionId: aws.String("ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI"),
	}

	req := svc.DeleteObjectTaggingRequest(input)
	result, err := req.Send(context.Background())
	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 delete multiple objects from a versioned bucket
//
// The following example deletes objects from a bucket. The bucket is versioned, and
// the request does not specify the object version to delete. In this case, all versions
// remain in the bucket and S3 adds a delete marker.
func ExampleClient_DeleteObjectsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteObjectsInput{
		Bucket: aws.String("examplebucket"),
		Delete: &s3.Delete{
			Objects: []s3.ObjectIdentifier{
				{
					Key: aws.String("objectkey1"),
				},
				{
					Key: aws.String("objectkey2"),
				},
			},
			Quiet: aws.Bool(false),
		},
	}

	req := svc.DeleteObjectsRequest(input)
	result, err := req.Send(context.Background())
	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 delete multiple object versions from a versioned bucket
//
// The following example deletes objects from a bucket. The request specifies object
// versions. S3 deletes specific object versions and returns the key and versions of
// deleted objects in the response.
func ExampleClient_DeleteObjectsRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.DeleteObjectsInput{
		Bucket: aws.String("examplebucket"),
		Delete: &s3.Delete{
			Objects: []s3.ObjectIdentifier{
				{
					Key:       aws.String("HappyFace.jpg"),
					VersionId: aws.String("2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b"),
				},
				{
					Key:       aws.String("HappyFace.jpg"),
					VersionId: aws.String("yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd"),
				},
			},
			Quiet: aws.Bool(false),
		},
	}

	req := svc.DeleteObjectsRequest(input)
	result, err := req.Send(context.Background())
	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 get cors configuration set on a bucket
//
// The following example returns cross-origin resource sharing (CORS) configuration
// set on a bucket.
func ExampleClient_GetBucketCorsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketCorsInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketCorsRequest(input)
	result, err := req.Send(context.Background())
	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 get a bucket acl
//
// The following example gets ACL on the specified bucket.
func ExampleClient_GetBucketLifecycleRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketLifecycleInput{
		Bucket: aws.String("acl1"),
	}

	req := svc.GetBucketLifecycleRequest(input)
	result, err := req.Send(context.Background())
	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 get lifecycle configuration on a bucket
//
// The following example retrieves lifecycle configuration on set on a bucket.
func ExampleClient_GetBucketLifecycleConfigurationRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketLifecycleConfigurationInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketLifecycleConfigurationRequest(input)
	result, err := req.Send(context.Background())
	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 get bucket location
//
// The following example returns bucket location.
func ExampleClient_GetBucketLocationRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketLocationInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketLocationRequest(input)
	result, err := req.Send(context.Background())
	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 get notification configuration set on a bucket
//
// The following example returns notification configuration set on a bucket.
func ExampleClient_GetBucketNotificationRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketNotificationInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketNotificationRequest(input)
	result, err := req.Send(context.Background())
	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 get notification configuration set on a bucket
//
// The following example returns notification configuration set on a bucket.
func ExampleClient_GetBucketNotificationRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketNotificationInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketNotificationRequest(input)
	result, err := req.Send(context.Background())
	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 get bucket policy
//
// The following example returns bucket policy associated with a bucket.
func ExampleClient_GetBucketPolicyRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketPolicyInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketPolicyRequest(input)
	result, err := req.Send(context.Background())
	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 get replication configuration set on a bucket
//
// The following example returns replication configuration set on a bucket.
func ExampleClient_GetBucketReplicationRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketReplicationInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketReplicationRequest(input)
	result, err := req.Send(context.Background())
	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 get bucket versioning configuration
//
// The following example retrieves bucket versioning configuration.
func ExampleClient_GetBucketRequestPaymentRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketRequestPaymentInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketRequestPaymentRequest(input)
	result, err := req.Send(context.Background())
	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 get tag set associated with a bucket
//
// The following example returns tag set associated with a bucket
func ExampleClient_GetBucketTaggingRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketTaggingInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketTaggingRequest(input)
	result, err := req.Send(context.Background())
	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 get bucket versioning configuration
//
// The following example retrieves bucket versioning configuration.
func ExampleClient_GetBucketVersioningRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketVersioningInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketVersioningRequest(input)
	result, err := req.Send(context.Background())
	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 get bucket website configuration
//
// The following example retrieves website configuration of a bucket.
func ExampleClient_GetBucketWebsiteRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetBucketWebsiteInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.GetBucketWebsiteRequest(input)
	result, err := req.Send(context.Background())
	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 retrieve a byte range of an object
//
// The following example retrieves an object for an S3 bucket. The request specifies
// the range header to retrieve a specific byte range.
func ExampleClient_GetObjectRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetObjectInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("SampleFile.txt"),
		Range:  aws.String("bytes=0-9"),
	}

	req := svc.GetObjectRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeNoSuchKey:
				fmt.Println(s3.ErrCodeNoSuchKey, aerr.Error())
			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 retrieve an object
//
// The following example retrieves an object for an S3 bucket.
func ExampleClient_GetObjectRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetObjectInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("HappyFace.jpg"),
	}

	req := svc.GetObjectRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeNoSuchKey:
				fmt.Println(s3.ErrCodeNoSuchKey, aerr.Error())
			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 retrieve object ACL
//
// The following example retrieves access control list (ACL) of an object.
func ExampleClient_GetObjectAclRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetObjectAclInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("HappyFace.jpg"),
	}

	req := svc.GetObjectAclRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeNoSuchKey:
				fmt.Println(s3.ErrCodeNoSuchKey, aerr.Error())
			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 retrieve tag set of an object
//
// The following example retrieves tag set of an object.
func ExampleClient_GetObjectTaggingRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetObjectTaggingInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("HappyFace.jpg"),
	}

	req := svc.GetObjectTaggingRequest(input)
	result, err := req.Send(context.Background())
	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 retrieve tag set of a specific object version
//
// The following example retrieves tag set of an object. The request specifies object
// version.
func ExampleClient_GetObjectTaggingRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetObjectTaggingInput{
		Bucket:    aws.String("examplebucket"),
		Key:       aws.String("exampleobject"),
		VersionId: aws.String("ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI"),
	}

	req := svc.GetObjectTaggingRequest(input)
	result, err := req.Send(context.Background())
	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 retrieve torrent files for an object
//
// The following example retrieves torrent files of an object.
func ExampleClient_GetObjectTorrentRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.GetObjectTorrentInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("HappyFace.jpg"),
	}

	req := svc.GetObjectTorrentRequest(input)
	result, err := req.Send(context.Background())
	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 determine if bucket exists
//
// This operation checks to see if a bucket exists.
func ExampleClient_HeadBucketRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.HeadBucketInput{
		Bucket: aws.String("acl1"),
	}

	req := svc.HeadBucketRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeNoSuchBucket:
				fmt.Println(s3.ErrCodeNoSuchBucket, aerr.Error())
			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 retrieve metadata of an object without returning the object itself
//
// The following example retrieves an object metadata.
func ExampleClient_HeadObjectRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.HeadObjectInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("HappyFace.jpg"),
	}

	req := svc.HeadObjectRequest(input)
	result, err := req.Send(context.Background())
	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 list object versions
//
// The following example return versions of an object with specific key name prefix.
// The request limits the number of items returned to two. If there are are more than
// two object version, S3 returns NextToken in the response. You can specify this token
// value in your next request to fetch next set of object versions.
func ExampleClient_ListBucketsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.ListBucketsInput{}

	req := svc.ListBucketsRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// List next set of multipart uploads when previous result is truncated
//
// The following example specifies the upload-id-marker and key-marker from previous
// truncated response to retrieve next setup of multipart uploads.
func ExampleClient_ListMultipartUploadsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.ListMultipartUploadsInput{
		Bucket:         aws.String("examplebucket"),
		KeyMarker:      aws.String("nextkeyfrompreviousresponse"),
		MaxUploads:     aws.Int64(2),
		UploadIdMarker: aws.String("valuefrompreviousresponse"),
	}

	req := svc.ListMultipartUploadsRequest(input)
	result, err := req.Send(context.Background())
	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 list in-progress multipart uploads on a bucket
//
// The following example lists in-progress multipart uploads on a specific bucket.
func ExampleClient_ListMultipartUploadsRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.ListMultipartUploadsInput{
		Bucket: aws.String("examplebucket"),
	}

	req := svc.ListMultipartUploadsRequest(input)
	result, err := req.Send(context.Background())
	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 list object versions
//
// The following example return versions of an object with specific key name prefix.
// The request limits the number of items returned to two. If there are are more than
// two object version, S3 returns NextToken in the response. You can specify this token
// value in your next request to fetch next set of object versions.
func ExampleClient_ListObjectVersionsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.ListObjectVersionsInput{
		Bucket: aws.String("examplebucket"),
		Prefix: aws.String("HappyFace.jpg"),
	}

	req := svc.ListObjectVersionsRequest(input)
	result, err := req.Send(context.Background())
	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 list objects in a bucket
//
// The following example list two objects in a bucket.
func ExampleClient_ListObjectsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.ListObjectsInput{
		Bucket:  aws.String("examplebucket"),
		MaxKeys: aws.Int64(2),
	}

	req := svc.ListObjectsRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeNoSuchBucket:
				fmt.Println(s3.ErrCodeNoSuchBucket, aerr.Error())
			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 get object list
//
// The following example retrieves object list. The request specifies max keys to limit
// response to include only 2 object keys.
func ExampleClient_ListObjectsV2Request_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.ListObjectsV2Input{
		Bucket:  aws.String("examplebucket"),
		MaxKeys: aws.Int64(2),
	}

	req := svc.ListObjectsV2Request(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeNoSuchBucket:
				fmt.Println(s3.ErrCodeNoSuchBucket, aerr.Error())
			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 list parts of a multipart upload.
//
// The following example lists parts uploaded for a specific multipart upload.
func ExampleClient_ListPartsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.ListPartsInput{
		Bucket:   aws.String("examplebucket"),
		Key:      aws.String("bigobject"),
		UploadId: aws.String("example7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--"),
	}

	req := svc.ListPartsRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Put bucket acl
//
// The following example replaces existing ACL on a bucket. The ACL grants the bucket
// owner (specified using the owner ID) and write permission to the LogDelivery group.
// Because this is a replace operation, you must specify all the grants in your request.
// To incrementally add or remove ACL grants, you might use the console.
func ExampleClient_PutBucketAclRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketAclInput{
		Bucket:           aws.String("examplebucket"),
		GrantFullControl: aws.String("id=examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484"),
		GrantWrite:       aws.String("uri=http://acs.amazonaws.com/groups/s3/LogDelivery"),
	}

	req := svc.PutBucketAclRequest(input)
	result, err := req.Send(context.Background())
	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 set cors configuration on a bucket.
//
// The following example enables PUT, POST, and DELETE requests from www.example.com,
// and enables GET requests from any domain.
func ExampleClient_PutBucketCorsRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketCorsInput{
		Bucket: aws.String(""),
		CORSConfiguration: &s3.CORSConfiguration{
			CORSRules: []s3.CORSRule{
				{
					AllowedHeaders: []string{
						"*",
					},
					AllowedMethods: []string{
						"PUT",
						"POST",
						"DELETE",
					},
					AllowedOrigins: []string{
						"http://www.example.com",
					},
					ExposeHeaders: []string{
						"x-amz-server-side-encryption",
					},
					MaxAgeSeconds: aws.Int64(3000),
				},
				{
					AllowedHeaders: []string{
						"Authorization",
					},
					AllowedMethods: []string{
						"GET",
					},
					AllowedOrigins: []string{
						"*",
					},
					MaxAgeSeconds: aws.Int64(3000),
				},
			},
		},
	}

	req := svc.PutBucketCorsRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Put bucket lifecycle
//
// The following example replaces existing lifecycle configuration, if any, on the specified
// bucket.
func ExampleClient_PutBucketLifecycleConfigurationRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketLifecycleConfigurationInput{
		Bucket: aws.String("examplebucket"),
		LifecycleConfiguration: &s3.BucketLifecycleConfiguration{
			Rules: []s3.LifecycleRule{
				{
					ID:     aws.String("TestOnly"),
					Status: s3.ExpirationStatusEnabled,
					Transitions: []s3.Transition{
						{
							Days:         aws.Int64(365),
							StorageClass: s3.TransitionStorageClassGlacier,
						},
					},
				},
			},
		},
	}

	req := svc.PutBucketLifecycleConfigurationRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Set logging configuration for a bucket
//
// The following example sets logging policy on a bucket. For the Log Delivery group
// to deliver logs to the destination bucket, it needs permission for the READ_ACP action
// which the policy grants.
func ExampleClient_PutBucketLoggingRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketLoggingInput{
		Bucket: aws.String("sourcebucket"),
		BucketLoggingStatus: &s3.BucketLoggingStatus{
			LoggingEnabled: &s3.LoggingEnabled{
				TargetBucket: aws.String("targetbucket"),
				TargetGrants: []s3.TargetGrant{
					{
						Permission: s3.BucketLogsPermissionRead,
					},
				},
				TargetPrefix: aws.String("MyBucketLogs/"),
			},
		},
	}

	req := svc.PutBucketLoggingRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Set notification configuration for a bucket
//
// The following example sets notification configuration on a bucket to publish the
// object created events to an SNS topic.
func ExampleClient_PutBucketNotificationConfigurationRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketNotificationConfigurationInput{
		Bucket: aws.String("examplebucket"),
		NotificationConfiguration: &s3.NotificationConfiguration{
			TopicConfigurations: []s3.TopicConfiguration{
				{
					Events: []s3.Event{
						s3.EventS3ObjectCreated,
					},
					TopicArn: aws.String("arn:aws:sns:us-west-2:123456789012:s3-notification-topic"),
				},
			},
		},
	}

	req := svc.PutBucketNotificationConfigurationRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Set bucket policy
//
// The following example sets a permission policy on a bucket.
func ExampleClient_PutBucketPolicyRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketPolicyInput{
		Bucket: aws.String("examplebucket"),
		Policy: aws.String("{\"Version\": \"2012-10-17\", \"Statement\": [{ \"Sid\": \"id-1\",\"Effect\": \"Allow\",\"Principal\": {\"AWS\": \"arn:aws:iam::123456789012:root\"}, \"Action\": [ \"s3:PutObject\",\"s3:PutObjectAcl\"], \"Resource\": [\"arn:aws:s3:::acl3/*\" ] } ]}"),
	}

	req := svc.PutBucketPolicyRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Set replication configuration on a bucket
//
// The following example sets replication configuration on a bucket.
func ExampleClient_PutBucketReplicationRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketReplicationInput{
		Bucket: aws.String("examplebucket"),
		ReplicationConfiguration: &s3.ReplicationConfiguration{
			Role: aws.String("arn:aws:iam::123456789012:role/examplerole"),
			Rules: []s3.ReplicationRule{
				{
					Prefix: aws.String(""),
					Status: s3.ReplicationRuleStatusEnabled,
				},
			},
		},
	}

	req := svc.PutBucketReplicationRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Set request payment configuration on a bucket.
//
// The following example sets request payment configuration on a bucket so that person
// requesting the download is charged.
func ExampleClient_PutBucketRequestPaymentRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketRequestPaymentInput{
		Bucket: aws.String("examplebucket"),
		RequestPaymentConfiguration: &s3.RequestPaymentConfiguration{
			Payer: s3.PayerRequester,
		},
	}

	req := svc.PutBucketRequestPaymentRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Set tags on a bucket
//
// The following example sets tags on a bucket. Any existing tags are replaced.
func ExampleClient_PutBucketTaggingRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketTaggingInput{
		Bucket: aws.String("examplebucket"),
		Tagging: &s3.Tagging{
			TagSet: []s3.Tag{
				{
					Key:   aws.String("Key1"),
					Value: aws.String("Value1"),
				},
				{
					Key:   aws.String("Key2"),
					Value: aws.String("Value2"),
				},
			},
		},
	}

	req := svc.PutBucketTaggingRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Set versioning configuration on a bucket
//
// The following example sets versioning configuration on bucket. The configuration
// enables versioning on the bucket.
func ExampleClient_PutBucketVersioningRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketVersioningInput{
		Bucket: aws.String("examplebucket"),
		VersioningConfiguration: &s3.VersioningConfiguration{
			MFADelete: s3.MFADeleteDisabled,
			Status:    s3.BucketVersioningStatusEnabled,
		},
	}

	req := svc.PutBucketVersioningRequest(input)
	result, err := req.Send(context.Background())
	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)
}

// Set website configuration on a bucket
//
// The following example adds website configuration to a bucket.
func ExampleClient_PutBucketWebsiteRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutBucketWebsiteInput{
		Bucket: aws.String("examplebucket"),
		WebsiteConfiguration: &s3.WebsiteConfiguration{
			ErrorDocument: &s3.ErrorDocument{
				Key: aws.String("error.html"),
			},
			IndexDocument: &s3.IndexDocument{
				Suffix: aws.String("index.html"),
			},
		},
	}

	req := svc.PutBucketWebsiteRequest(input)
	result, err := req.Send(context.Background())
	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 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 ExampleClient_PutObjectRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectInput{
		Body:                 aws.ReadSeekCloser(strings.NewReader("filetoupload")),
		Bucket:               aws.String("examplebucket"),
		Key:                  aws.String("exampleobject"),
		ServerSideEncryption: s3.ServerSideEncryptionAes256,
		Tagging:              aws.String("key1=value1&key2=value2"),
	}

	req := svc.PutObjectRequest(input)
	result, err := req.Send(context.Background())
	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 ExampleClient_PutObjectRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectInput{
		Body:   aws.ReadSeekCloser(strings.NewReader("filetoupload")),
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("objectkey"),
	}

	req := svc.PutObjectRequest(input)
	result, err := req.Send(context.Background())
	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 ExampleClient_PutObjectRequest_shared02() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectInput{
		ACL:    s3.ObjectCannedACLAuthenticatedRead,
		Body:   aws.ReadSeekCloser(strings.NewReader("filetoupload")),
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("exampleobject"),
	}

	req := svc.PutObjectRequest(input)
	result, err := req.Send(context.Background())
	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 ExampleClient_PutObjectRequest_shared03() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectInput{
		Body:   aws.ReadSeekCloser(strings.NewReader("HappyFace.jpg")),
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("HappyFace.jpg"),
	}

	req := svc.PutObjectRequest(input)
	result, err := req.Send(context.Background())
	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 object and specify user-defined metadata
//
// 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 ExampleClient_PutObjectRequest_shared04() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectInput{
		Body:   aws.ReadSeekCloser(strings.NewReader("filetoupload")),
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("exampleobject"),
		Metadata: map[string]string{
			"metadata1": "value1",
			"metadata2": "value2",
		},
	}

	req := svc.PutObjectRequest(input)
	result, err := req.Send(context.Background())
	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
// to directs S3 to use specific storage class and use server-side encryption.
func ExampleClient_PutObjectRequest_shared05() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectInput{
		Body:                 aws.ReadSeekCloser(strings.NewReader("HappyFace.jpg")),
		Bucket:               aws.String("examplebucket"),
		Key:                  aws.String("HappyFace.jpg"),
		ServerSideEncryption: s3.ServerSideEncryptionAes256,
		StorageClass:         s3.StorageClassStandardIa,
	}

	req := svc.PutObjectRequest(input)
	result, err := req.Send(context.Background())
	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 ExampleClient_PutObjectRequest_shared06() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectInput{
		Body:    aws.ReadSeekCloser(strings.NewReader("c:\\HappyFace.jpg")),
		Bucket:  aws.String("examplebucket"),
		Key:     aws.String("HappyFace.jpg"),
		Tagging: aws.String("key1=value1&key2=value2"),
	}

	req := svc.PutObjectRequest(input)
	result, err := req.Send(context.Background())
	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 grant permissions using object ACL
//
// The following example adds grants to an object ACL. The first permission grants user1
// and user2 FULL_CONTROL and the AllUsers group READ permission.
func ExampleClient_PutObjectAclRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectAclInput{
		AccessControlPolicy: &s3.AccessControlPolicy{},
		Bucket:              aws.String("examplebucket"),
		GrantFullControl:    aws.String("emailaddress=user1@example.com,emailaddress=user2@example.com"),
		GrantRead:           aws.String("uri=http://acs.amazonaws.com/groups/global/AllUsers"),
		Key:                 aws.String("HappyFace.jpg"),
	}

	req := svc.PutObjectAclRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeNoSuchKey:
				fmt.Println(s3.ErrCodeNoSuchKey, aerr.Error())
			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 add tags to an existing object
//
// The following example adds tags to an existing object.
func ExampleClient_PutObjectTaggingRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.PutObjectTaggingInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("HappyFace.jpg"),
		Tagging: &s3.Tagging{
			TagSet: []s3.Tag{
				{
					Key:   aws.String("Key3"),
					Value: aws.String("Value3"),
				},
				{
					Key:   aws.String("Key4"),
					Value: aws.String("Value4"),
				},
			},
		},
	}

	req := svc.PutObjectTaggingRequest(input)
	result, err := req.Send(context.Background())
	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 restore an archived object
//
// The following example restores for one day an archived copy of an object back into
// Amazon S3 bucket.
func ExampleClient_RestoreObjectRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.RestoreObjectInput{
		Bucket: aws.String("examplebucket"),
		Key:    aws.String("archivedobjectkey"),
		RestoreRequest: &s3.RestoreRequest{
			Days: aws.Int64(1),
			GlacierJobParameters: &s3.GlacierJobParameters{
				Tier: s3.TierExpedited,
			},
		},
	}

	req := svc.RestoreObjectRequest(input)
	result, err := req.Send(context.Background())
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case s3.ErrCodeObjectAlreadyInActiveTierError:
				fmt.Println(s3.ErrCodeObjectAlreadyInActiveTierError, aerr.Error())
			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
//
// The following example uploads part 1 of a multipart upload. The example specifies
// a file name for the part data. The Upload ID is same that is returned by the initiate
// multipart upload.
func ExampleClient_UploadPartRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.UploadPartInput{
		Body:       aws.ReadSeekCloser(strings.NewReader("fileToUpload")),
		Bucket:     aws.String("examplebucket"),
		Key:        aws.String("examplelargeobject"),
		PartNumber: aws.Int64(1),
		UploadId:   aws.String("xadcOB_7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--"),
	}

	req := svc.UploadPartRequest(input)
	result, err := req.Send(context.Background())
	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 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 ExampleClient_UploadPartCopyRequest_shared00() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	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--"),
	}

	req := svc.UploadPartCopyRequest(input)
	result, err := req.Send(context.Background())
	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 ExampleClient_UploadPartCopyRequest_shared01() {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		panic("failed to load config, " + err.Error())
	}

	svc := s3.New(cfg)
	input := &s3.UploadPartCopyInput{
		Bucket:          aws.String("examplebucket"),
		CopySource:      aws.String("/bucketname/sourceobjectkey"),
		CopySourceRange: aws.String("bytes=1-100000"),
		Key:             aws.String("examplelargeobject"),
		PartNumber:      aws.Int64(2),
		UploadId:        aws.String("exampleuoh_10OhKhT7YukE9bjzTPRiuaCotmZM_pFngJFir9OZNrSr5cWa3cq3LZSUsfjI4FI7PkP91We7Nrw--"),
	}

	req := svc.UploadPartCopyRequest(input)
	result, err := req.Send(context.Background())
	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)
}
