func TestOutputService4ProtocolTestListsCase2(t *testing.T) { sess := session.New() svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", null], \"ListMemberMap\": [{}, null, null, {}], \"ListMemberStruct\": [{}, null, null, {}]}")) req, out := svc.OutputService4TestCaseOperation2Request(nil) req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} // set headers // unmarshal response jsonrpc.UnmarshalMeta(req) jsonrpc.Unmarshal(req) assert.NoError(t, req.Error) // assert response assert.NotNil(t, out) // ensure out variable is used assert.Equal(t, "a", *out.ListMember[0]) assert.Nil(t, out.ListMember[1]) assert.Nil(t, out.ListMemberMap[1]) assert.Nil(t, out.ListMemberMap[2]) assert.Nil(t, out.ListMemberStruct[1]) assert.Nil(t, out.ListMemberStruct[2]) }
func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) { sess := session.New() svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } req, _ := svc.InputService2TestCaseOperation1Request(input) r := req.HTTPRequest // build request jsonrpc.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) awstesting.AssertJSON(t, `{"TimeArg":1422172800}`, util.Trim(string(body))) // assert URL awstesting.AssertURL(t, "https://test/", r.URL.String()) // assert headers assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) }
func TestInputService3ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { sess := session.New() svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputShape{ BlobArg: []byte("foo"), } req, _ := svc.InputService3TestCaseOperation1Request(input) r := req.HTTPRequest // build request jsonrpc.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) awstesting.AssertJSON(t, `{"BlobArg":"Zm9v"}`, util.Trim(string(body))) // assert URL awstesting.AssertURL(t, "https://test/", r.URL.String()) // assert headers assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) }
func TestInputService5ProtocolTestRecursiveShapesCase6(t *testing.T) { sess := session.New() svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputShape{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ RecursiveMap: map[string]*InputService5TestShapeRecursiveStructType{ "bar": { NoRecurse: aws.String("bar"), }, "foo": { NoRecurse: aws.String("foo"), }, }, }, } req, _ := svc.InputService5TestCaseOperation6Request(input) r := req.HTTPRequest // build request jsonrpc.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveMap":{"foo":{"NoRecurse":"foo"},"bar":{"NoRecurse":"bar"}}}}`, util.Trim(string(body))) // assert URL awstesting.AssertURL(t, "https://test/", r.URL.String()) // assert headers assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) }
func ExampleRoute53_UpdateHealthCheck() { svc := route53.New(session.New()) params := &route53.UpdateHealthCheckInput{ HealthCheckId: aws.String("HealthCheckId"), // Required ChildHealthChecks: []*string{ aws.String("HealthCheckId"), // Required // More values... }, FailureThreshold: aws.Int64(1), FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"), HealthCheckVersion: aws.Int64(1), HealthThreshold: aws.Int64(1), IPAddress: aws.String("IPAddress"), Inverted: aws.Bool(true), Port: aws.Int64(1), ResourcePath: aws.String("ResourcePath"), SearchString: aws.String("SearchString"), } resp, err := svc.UpdateHealthCheck(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleRoute53_ChangeTagsForResource() { svc := route53.New(session.New()) params := &route53.ChangeTagsForResourceInput{ ResourceId: aws.String("TagResourceId"), // Required ResourceType: aws.String("TagResourceType"), // Required AddTags: []*route53.Tag{ { // Required Key: aws.String("TagKey"), Value: aws.String("TagValue"), }, // More values... }, RemoveTagKeys: []*string{ aws.String("TagKey"), // Required // More values... }, } resp, err := svc.ChangeTagsForResource(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { sess := session.New() svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("<OperationNameResponse><Str>myname</Str><FooNum>123</FooNum><FalseBool>false</FalseBool><TrueBool>true</TrueBool><Float>1.2</Float><Double>1.3</Double><Long>200</Long><Char>a</Char><RequestId>request-id</RequestId></OperationNameResponse>")) req, out := svc.OutputService1TestCaseOperation1Request(nil) req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} // set headers // unmarshal response ec2query.UnmarshalMeta(req) ec2query.Unmarshal(req) assert.NoError(t, req.Error) // assert response assert.NotNil(t, out) // ensure out variable is used assert.Equal(t, "a", *out.Char) assert.Equal(t, 1.3, *out.Double) assert.Equal(t, false, *out.FalseBool) assert.Equal(t, 1.2, *out.Float) assert.Equal(t, int64(200), *out.Long) assert.Equal(t, int64(123), *out.Num) assert.Equal(t, "myname", *out.Str) assert.Equal(t, true, *out.TrueBool) }
func ExampleSES_SendRawEmail() { svc := ses.New(session.New()) params := &ses.SendRawEmailInput{ RawMessage: &ses.RawMessage{ // Required Data: []byte("PAYLOAD"), // Required }, Destinations: []*string{ aws.String("Address"), // Required // More values... }, FromArn: aws.String("AmazonResourceName"), ReturnPathArn: aws.String("AmazonResourceName"), Source: aws.String("Address"), SourceArn: aws.String("AmazonResourceName"), } resp, err := svc.SendRawEmail(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { server := initTestServer("2014-12-16T01:51:37Z", false) defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), ExpiryWindow: time.Hour * 1, } p.CurrentTime = func() time.Time { return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC) } assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") _, err := p.Retrieve() assert.Nil(t, err, "Expect no error, %v", err) assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") p.CurrentTime = func() time.Time { return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC) } assert.True(t, p.IsExpired(), "Expect creds to be expired.") }
func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) { sess := session.New() svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ Bar: aws.String("val2"), Foo: aws.String("val1"), Yuck: aws.String("val3"), } req, _ := svc.InputService2TestCaseOperation1Request(input) r := req.HTTPRequest // build request ec2query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) awstesting.AssertQuery(t, `Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`, util.Trim(string(body))) // assert URL awstesting.AssertURL(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { sess := session.New() svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputService3TestCaseOperation1Input{ StructArg: &InputService3TestShapeStructType{ ScalarArg: aws.String("foo"), }, } req, _ := svc.InputService3TestCaseOperation1Request(input) r := req.HTTPRequest // build request ec2query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) awstesting.AssertQuery(t, `Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`, util.Trim(string(body))) // assert URL awstesting.AssertURL(t, "https://test/", r.URL.String()) // assert headers }
func ExampleOpsWorks_CreateDeployment() { svc := opsworks.New(session.New()) params := &opsworks.CreateDeploymentInput{ Command: &opsworks.DeploymentCommand{ // Required Name: aws.String("DeploymentCommandName"), // Required Args: map[string][]*string{ "Key": { // Required aws.String("String"), // Required // More values... }, // More values... }, }, StackId: aws.String("String"), // Required AppId: aws.String("String"), Comment: aws.String("String"), CustomJson: aws.String("String"), InstanceIds: []*string{ aws.String("String"), // Required // More values... }, } resp, err := svc.CreateDeployment(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleRoute53_ListChangeBatchesByRRSet() { svc := route53.New(session.New()) params := &route53.ListChangeBatchesByRRSetInput{ EndDate: aws.String("Date"), // Required HostedZoneId: aws.String("ResourceId"), // Required Name: aws.String("DNSName"), // Required StartDate: aws.String("Date"), // Required Type: aws.String("RRType"), // Required Marker: aws.String("PageMarker"), MaxItems: aws.String("PageMaxItems"), SetIdentifier: aws.String("ResourceRecordSetIdentifier"), } resp, err := svc.ListChangeBatchesByRRSet(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleOpsWorks_UpdateInstance() { svc := opsworks.New(session.New()) params := &opsworks.UpdateInstanceInput{ InstanceId: aws.String("String"), // Required AgentVersion: aws.String("String"), AmiId: aws.String("String"), Architecture: aws.String("Architecture"), AutoScalingType: aws.String("AutoScalingType"), EbsOptimized: aws.Bool(true), Hostname: aws.String("String"), InstallUpdatesOnBoot: aws.Bool(true), InstanceType: aws.String("String"), LayerIds: []*string{ aws.String("String"), // Required // More values... }, Os: aws.String("String"), SshKeyName: aws.String("String"), } resp, err := svc.UpdateInstance(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleOpsWorks_CreateApp() { svc := opsworks.New(session.New()) params := &opsworks.CreateAppInput{ Name: aws.String("String"), // Required StackId: aws.String("String"), // Required Type: aws.String("AppType"), // Required AppSource: &opsworks.Source{ Password: aws.String("String"), Revision: aws.String("String"), SshKey: aws.String("String"), Type: aws.String("SourceType"), Url: aws.String("String"), Username: aws.String("String"), }, Attributes: map[string]*string{ "Key": aws.String("String"), // Required // More values... }, DataSources: []*opsworks.DataSource{ { // Required Arn: aws.String("String"), DatabaseName: aws.String("String"), Type: aws.String("String"), }, // More values... }, Description: aws.String("String"), Domains: []*string{ aws.String("String"), // Required // More values... }, EnableSsl: aws.Bool(true), Environment: []*opsworks.EnvironmentVariable{ { // Required Key: aws.String("String"), // Required Value: aws.String("String"), // Required Secure: aws.Bool(true), }, // More values... }, Shortname: aws.String("String"), SslConfiguration: &opsworks.SslConfiguration{ Certificate: aws.String("String"), // Required PrivateKey: aws.String("String"), // Required Chain: aws.String("String"), }, } resp, err := svc.CreateApp(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleOpsWorks_RegisterInstance() { svc := opsworks.New(session.New()) params := &opsworks.RegisterInstanceInput{ StackId: aws.String("String"), // Required Hostname: aws.String("String"), InstanceIdentity: &opsworks.InstanceIdentity{ Document: aws.String("String"), Signature: aws.String("String"), }, PrivateIp: aws.String("String"), PublicIp: aws.String("String"), RsaPublicKey: aws.String("String"), RsaPublicKeyFingerprint: aws.String("String"), } resp, err := svc.RegisterInstance(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func TestInputService4ProtocolTestListTypesCase1(t *testing.T) { sess := session.New() svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService4TestShapeInputService4TestCaseOperation1Input{ ListArg: []*string{ aws.String("foo"), aws.String("bar"), aws.String("baz"), }, } req, _ := svc.InputService4TestCaseOperation1Request(input) r := req.HTTPRequest // build request ec2query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) awstesting.AssertQuery(t, `Action=OperationName&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&Version=2014-01-01`, util.Trim(string(body))) // assert URL awstesting.AssertURL(t, "https://test/", r.URL.String()) // assert headers }
func ExampleS3_CreateBucket() { svc := s3.New(session.New()) params := &s3.CreateBucketInput{ Bucket: aws.String("BucketName"), // Required ACL: aws.String("BucketCannedACL"), CreateBucketConfiguration: &s3.CreateBucketConfiguration{ LocationConstraint: aws.String("BucketLocationConstraint"), }, GrantFullControl: aws.String("GrantFullControl"), GrantRead: aws.String("GrantRead"), GrantReadACP: aws.String("GrantReadACP"), GrantWrite: aws.String("GrantWrite"), GrantWriteACP: aws.String("GrantWriteACP"), } resp, err := svc.CreateBucket(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleRoute53_CreateHostedZone() { svc := route53.New(session.New()) params := &route53.CreateHostedZoneInput{ CallerReference: aws.String("Nonce"), // Required Name: aws.String("DNSName"), // Required DelegationSetId: aws.String("ResourceId"), HostedZoneConfig: &route53.HostedZoneConfig{ Comment: aws.String("ResourceDescription"), PrivateZone: aws.Bool(true), }, VPC: &route53.VPC{ VPCId: aws.String("VPCId"), VPCRegion: aws.String("VPCRegion"), }, } resp, err := svc.CreateHostedZone(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func TestOutputService9ProtocolTestSupportsHeaderMapsCase1(t *testing.T) { sess := session.New() svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{}")) req, out := svc.OutputService9TestCaseOperation1Request(nil) req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} // set headers req.HTTPResponse.Header.Set("Content-Length", "10") req.HTTPResponse.Header.Set("X-Bam", "boo") req.HTTPResponse.Header.Set("X-Foo", "bar") // unmarshal response restjson.UnmarshalMeta(req) restjson.Unmarshal(req) assert.NoError(t, req.Error) // assert response assert.NotNil(t, out) // ensure out variable is used assert.Equal(t, "10", *out.AllHeaders["Content-Length"]) assert.Equal(t, "boo", *out.AllHeaders["X-Bam"]) assert.Equal(t, "bar", *out.AllHeaders["X-Foo"]) assert.Equal(t, "boo", *out.PrefixedHeaders["Bam"]) assert.Equal(t, "bar", *out.PrefixedHeaders["Foo"]) }
func ExampleS3_HeadObject() { svc := s3.New(session.New()) params := &s3.HeadObjectInput{ Bucket: aws.String("BucketName"), // Required Key: aws.String("ObjectKey"), // Required IfMatch: aws.String("IfMatch"), IfModifiedSince: aws.Time(time.Now()), IfNoneMatch: aws.String("IfNoneMatch"), IfUnmodifiedSince: aws.Time(time.Now()), Range: aws.String("Range"), RequestPayer: aws.String("RequestPayer"), SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), SSECustomerKey: aws.String("SSECustomerKey"), SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), VersionId: aws.String("ObjectVersionId"), } resp, err := svc.HeadObject(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { sess := session.New() svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}")) req, out := svc.OutputService1TestCaseOperation1Request(nil) req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} // set headers req.HTTPResponse.Header.Set("ImaHeader", "test") req.HTTPResponse.Header.Set("X-Foo", "abc") // unmarshal response restjson.UnmarshalMeta(req) restjson.Unmarshal(req) assert.NoError(t, req.Error) // assert response assert.NotNil(t, out) // ensure out variable is used assert.Equal(t, "a", *out.Char) assert.Equal(t, 1.3, *out.Double) assert.Equal(t, false, *out.FalseBool) assert.Equal(t, 1.2, *out.Float) assert.Equal(t, "test", *out.ImaHeader) assert.Equal(t, "abc", *out.ImaHeaderLocation) assert.Equal(t, int64(200), *out.Long) assert.Equal(t, int64(123), *out.Num) assert.Equal(t, int64(200), *out.Status) assert.Equal(t, "myname", *out.Str) assert.Equal(t, true, *out.TrueBool) }
func ExampleS3_DeleteObjects() { svc := s3.New(session.New()) params := &s3.DeleteObjectsInput{ Bucket: aws.String("BucketName"), // Required Delete: &s3.Delete{ // Required Objects: []*s3.ObjectIdentifier{ // Required { // Required Key: aws.String("ObjectKey"), // Required VersionId: aws.String("ObjectVersionId"), }, // More values... }, Quiet: aws.Bool(true), }, MFA: aws.String("MFA"), RequestPayer: aws.String("RequestPayer"), } resp, err := svc.DeleteObjects(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleS3_CompleteMultipartUpload() { svc := s3.New(session.New()) params := &s3.CompleteMultipartUploadInput{ Bucket: aws.String("BucketName"), // Required Key: aws.String("ObjectKey"), // Required UploadId: aws.String("MultipartUploadId"), // Required MultipartUpload: &s3.CompletedMultipartUpload{ Parts: []*s3.CompletedPart{ { // Required ETag: aws.String("ETag"), PartNumber: aws.Int64(1), }, // More values... }, }, RequestPayer: aws.String("RequestPayer"), } resp, err := svc.CompleteMultipartUpload(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleS3_UploadPartCopy() { svc := s3.New(session.New()) params := &s3.UploadPartCopyInput{ Bucket: aws.String("BucketName"), // Required CopySource: aws.String("CopySource"), // Required Key: aws.String("ObjectKey"), // Required PartNumber: aws.Int64(1), // Required UploadId: aws.String("MultipartUploadId"), // Required CopySourceIfMatch: aws.String("CopySourceIfMatch"), CopySourceIfModifiedSince: aws.Time(time.Now()), CopySourceIfNoneMatch: aws.String("CopySourceIfNoneMatch"), CopySourceIfUnmodifiedSince: aws.Time(time.Now()), CopySourceRange: aws.String("CopySourceRange"), CopySourceSSECustomerAlgorithm: aws.String("CopySourceSSECustomerAlgorithm"), CopySourceSSECustomerKey: aws.String("CopySourceSSECustomerKey"), CopySourceSSECustomerKeyMD5: aws.String("CopySourceSSECustomerKeyMD5"), RequestPayer: aws.String("RequestPayer"), SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), SSECustomerKey: aws.String("SSECustomerKey"), SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), } resp, err := svc.UploadPartCopy(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleS3_UploadPart() { svc := s3.New(session.New()) params := &s3.UploadPartInput{ Bucket: aws.String("BucketName"), // Required Key: aws.String("ObjectKey"), // Required PartNumber: aws.Int64(1), // Required UploadId: aws.String("MultipartUploadId"), // Required Body: bytes.NewReader([]byte("PAYLOAD")), ContentLength: aws.Int64(1), RequestPayer: aws.String("RequestPayer"), SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), SSECustomerKey: aws.String("SSECustomerKey"), SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), } resp, err := svc.UploadPart(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleS3_PutBucketTagging() { svc := s3.New(session.New()) params := &s3.PutBucketTaggingInput{ Bucket: aws.String("BucketName"), // Required Tagging: &s3.Tagging{ // Required TagSet: []*s3.Tag{ // Required { // Required Key: aws.String("ObjectKey"), // Required Value: aws.String("Value"), // Required }, // More values... }, }, } resp, err := svc.PutBucketTagging(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleS3_PutBucketReplication() { svc := s3.New(session.New()) params := &s3.PutBucketReplicationInput{ Bucket: aws.String("BucketName"), // Required ReplicationConfiguration: &s3.ReplicationConfiguration{ // Required Role: aws.String("Role"), // Required Rules: []*s3.ReplicationRule{ // Required { // Required Destination: &s3.Destination{ // Required Bucket: aws.String("BucketName"), // Required StorageClass: aws.String("StorageClass"), }, Prefix: aws.String("Prefix"), // Required Status: aws.String("ReplicationRuleStatus"), // Required ID: aws.String("ID"), }, // More values... }, }, } resp, err := svc.PutBucketReplication(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func TestNewDefaultSession(t *testing.T) { s := session.New(&aws.Config{Region: aws.String("region")}) assert.Equal(t, "region", *s.Config.Region) assert.Equal(t, http.DefaultClient, s.Config.HTTPClient) assert.NotNil(t, s.Config.Logger) assert.Equal(t, aws.LogOff, *s.Config.LogLevel) }
func ExampleOpsWorks_CloneStack() { svc := opsworks.New(session.New()) params := &opsworks.CloneStackInput{ ServiceRoleArn: aws.String("String"), // Required SourceStackId: aws.String("String"), // Required AgentVersion: aws.String("String"), Attributes: map[string]*string{ "Key": aws.String("String"), // Required // More values... }, ChefConfiguration: &opsworks.ChefConfiguration{ BerkshelfVersion: aws.String("String"), ManageBerkshelf: aws.Bool(true), }, CloneAppIds: []*string{ aws.String("String"), // Required // More values... }, ClonePermissions: aws.Bool(true), ConfigurationManager: &opsworks.StackConfigurationManager{ Name: aws.String("String"), Version: aws.String("String"), }, CustomCookbooksSource: &opsworks.Source{ Password: aws.String("String"), Revision: aws.String("String"), SshKey: aws.String("String"), Type: aws.String("SourceType"), Url: aws.String("String"), Username: aws.String("String"), }, CustomJson: aws.String("String"), DefaultAvailabilityZone: aws.String("String"), DefaultInstanceProfileArn: aws.String("String"), DefaultOs: aws.String("String"), DefaultRootDeviceType: aws.String("RootDeviceType"), DefaultSshKeyName: aws.String("String"), DefaultSubnetId: aws.String("String"), HostnameTheme: aws.String("String"), Name: aws.String("String"), Region: aws.String("String"), UseCustomCookbooks: aws.Bool(true), UseOpsworksSecurityGroups: aws.Bool(true), VpcId: aws.String("String"), } resp, err := svc.CloneStack(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }