func ExampleSSM_ListDocuments() { svc := ssm.New(nil) params := &ssm.ListDocumentsInput{ DocumentFilterList: []*ssm.DocumentFilter{ { // Required Key: aws.String("DocumentFilterKey"), // Required Value: aws.String("DocumentFilterValue"), // Required }, // More values... }, MaxResults: aws.Int64(1), NextToken: aws.String("NextToken"), } resp, err := svc.ListDocuments(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 TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { svc := NewInputService4ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService4TestShapeInputShape{ ListArg: []*string{ aws.String("a"), aws.String("b"), aws.String("c"), }, ScalarArg: aws.String("foo"), } req, _ := svc.InputService4TestCaseOperation1Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&ListArg.1=a&ListArg.2=b&ListArg.3=c&ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService9ProtocolTestRecursiveShapesCase6(t *testing.T) { svc := NewInputService9ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService9TestShapeInputShape{ RecursiveStruct: &InputService9TestShapeRecursiveStructType{ RecursiveMap: map[string]*InputService9TestShapeRecursiveStructType{ "bar": { NoRecurse: aws.String("bar"), }, "foo": { NoRecurse: aws.String("foo"), }, }, }, } req, _ := svc.InputService9TestCaseOperation6Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.RecursiveMap.entry.1.key=bar&RecursiveStruct.RecursiveMap.entry.1.value.NoRecurse=bar&RecursiveStruct.RecursiveMap.entry.2.key=foo&RecursiveStruct.RecursiveMap.entry.2.value.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func ExampleCloudFormation_EstimateTemplateCost() { svc := cloudformation.New(nil) params := &cloudformation.EstimateTemplateCostInput{ Parameters: []*cloudformation.Parameter{ { // Required ParameterKey: aws.String("ParameterKey"), ParameterValue: aws.String("ParameterValue"), UsePreviousValue: aws.Bool(true), }, // More values... }, TemplateBody: aws.String("TemplateBody"), TemplateURL: aws.String("TemplateURL"), } resp, err := svc.EstimateTemplateCost(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 TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { svc := NewInputService1ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService1TestShapeInputService1TestCaseOperation1Input{ Bar: aws.String("val2"), Foo: aws.String("val1"), } req, _ := svc.InputService1TestCaseOperation1Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func ExampleDataPipeline_AddTags() { svc := datapipeline.New(nil) params := &datapipeline.AddTagsInput{ PipelineId: aws.String("id"), // Required Tags: []*datapipeline.Tag{ // Required { // Required Key: aws.String("tagKey"), // Required Value: aws.String("tagValue"), // Required }, // More values... }, } resp, err := svc.AddTags(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) }
// Retrieve generates a new set of temporary credentials using STS. func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { // Apply defaults where parameters are not set. if p.Client == nil { p.Client = sts.New(nil) } if p.RoleSessionName == "" { // Try to work out a role name that will hopefully end up unique. p.RoleSessionName = fmt.Sprintf("%d", time.Now().UTC().UnixNano()) } if p.Duration == 0 { // Expire as often as AWS permits. p.Duration = 15 * time.Minute } roleOutput, err := p.Client.AssumeRole(&sts.AssumeRoleInput{ DurationSeconds: aws.Int64(int64(p.Duration / time.Second)), RoleArn: aws.String(p.RoleARN), RoleSessionName: aws.String(p.RoleSessionName), }) if err != nil { return credentials.Value{}, err } // We will proactively generate new credentials before they expire. p.SetExpiration(*roleOutput.Credentials.Expiration, p.ExpiryWindow) return credentials.Value{ AccessKeyID: *roleOutput.Credentials.AccessKeyId, SecretAccessKey: *roleOutput.Credentials.SecretAccessKey, SessionToken: *roleOutput.Credentials.SessionToken, }, nil }
func ExampleEMR_ModifyInstanceGroups() { svc := emr.New(nil) params := &emr.ModifyInstanceGroupsInput{ InstanceGroups: []*emr.InstanceGroupModifyConfig{ { // Required InstanceGroupId: aws.String("XmlStringMaxLen256"), // Required EC2InstanceIdsToTerminate: []*string{ aws.String("InstanceId"), // Required // More values... }, InstanceCount: aws.Int64(1), }, // More values... }, } resp, err := svc.ModifyInstanceGroups(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 TestInputService4ProtocolTestURIParameterQuerystringParamsAndJSONBodyCase1(t *testing.T) { svc := NewInputService4ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService4TestShapeInputService4TestCaseOperation1Input{ Ascending: aws.String("true"), Config: &InputService4TestShapeStructType{ A: aws.String("one"), B: aws.String("two"), }, PageToken: aws.String("bar"), PipelineId: aws.String("foo"), } req, _ := svc.InputService4TestCaseOperation1Request(input) r := req.HTTPRequest // build request restjson.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`{"Config":{"A":"one","B":"two"}}`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String()) // assert headers }
func ExampleEMR_DescribeJobFlows() { svc := emr.New(nil) params := &emr.DescribeJobFlowsInput{ CreatedAfter: aws.Time(time.Now()), CreatedBefore: aws.Time(time.Now()), JobFlowIds: []*string{ aws.String("XmlString"), // Required // More values... }, JobFlowStates: []*string{ aws.String("JobFlowExecutionState"), // Required // More values... }, } resp, err := svc.DescribeJobFlows(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 ExampleEMR_ListSteps() { svc := emr.New(nil) params := &emr.ListStepsInput{ ClusterId: aws.String("ClusterId"), // Required Marker: aws.String("Marker"), StepIds: []*string{ aws.String("XmlString"), // Required // More values... }, StepStates: []*string{ aws.String("StepState"), // Required // More values... }, } resp, err := svc.ListSteps(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 ExampleEMR_AddTags() { svc := emr.New(nil) params := &emr.AddTagsInput{ ResourceId: aws.String("ResourceId"), // Required Tags: []*emr.Tag{ // Required { // Required Key: aws.String("String"), Value: aws.String("String"), }, // More values... }, } resp, err := svc.AddTags(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 ExampleCloudSearch_DefineSuggester() { svc := cloudsearch.New(nil) params := &cloudsearch.DefineSuggesterInput{ DomainName: aws.String("DomainName"), // Required Suggester: &cloudsearch.Suggester{ // Required DocumentSuggesterOptions: &cloudsearch.DocumentSuggesterOptions{ // Required SourceField: aws.String("FieldName"), // Required FuzzyMatching: aws.String("SuggesterFuzzyMatching"), SortExpression: aws.String("String"), }, SuggesterName: aws.String("StandardName"), // Required }, } resp, err := svc.DefineSuggester(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 ExampleSSM_UpdateAssociationStatus() { svc := ssm.New(nil) params := &ssm.UpdateAssociationStatusInput{ AssociationStatus: &ssm.AssociationStatus{ // Required Date: aws.Time(time.Now()), // Required Message: aws.String("StatusMessage"), // Required Name: aws.String("AssociationStatusName"), // Required AdditionalInfo: aws.String("StatusAdditionalInfo"), }, InstanceId: aws.String("InstanceId"), // Required Name: aws.String("DocumentName"), // Required } resp, err := svc.UpdateAssociationStatus(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 ExampleDataPipeline_ActivatePipeline() { svc := datapipeline.New(nil) params := &datapipeline.ActivatePipelineInput{ PipelineId: aws.String("id"), // Required ParameterValues: []*datapipeline.ParameterValue{ { // Required Id: aws.String("fieldNameString"), // Required StringValue: aws.String("fieldStringValue"), // Required }, // More values... }, StartTimestamp: aws.Time(time.Now()), } resp, err := svc.ActivatePipeline(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 TestInputService6ProtocolTestStreamingPayloadCase1(t *testing.T) { svc := NewInputService6ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService6TestShapeInputService6TestCaseOperation1Input{ Body: aws.ReadSeekCloser(bytes.NewBufferString("contents")), Checksum: aws.String("foo"), VaultName: aws.String("name"), } req, _ := svc.InputService6TestCaseOperation1Request(input) r := req.HTTPRequest // build request restjson.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`contents`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/2014-01-01/vaults/name/archives", r.URL.String()) // assert headers assert.Equal(t, "foo", r.Header.Get("x-amz-sha256-tree-hash")) }
func ExampleDataPipeline_ReportTaskProgress() { svc := datapipeline.New(nil) params := &datapipeline.ReportTaskProgressInput{ TaskId: aws.String("taskId"), // Required Fields: []*datapipeline.Field{ { // Required Key: aws.String("fieldNameString"), // Required RefValue: aws.String("fieldNameString"), StringValue: aws.String("fieldStringValue"), }, // More values... }, } resp, err := svc.ReportTaskProgress(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 TestInputService8ProtocolTestRecursiveShapesCase6(t *testing.T) { svc := NewInputService8ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService8TestShapeInputShape{ RecursiveStruct: &InputService8TestShapeRecursiveStructType{ RecursiveMap: map[string]*InputService8TestShapeRecursiveStructType{ "bar": { NoRecurse: aws.String("bar"), }, "foo": { NoRecurse: aws.String("foo"), }, }, }, } req, _ := svc.InputService8TestCaseOperation6Request(input) r := req.HTTPRequest // build request restjson.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`{"RecursiveStruct":{"RecursiveMap":{"bar":{"NoRecurse":"bar"},"foo":{"NoRecurse":"foo"}}}}`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/path", r.URL.String()) // assert headers }
func ExampleDataPipeline_CreatePipeline() { svc := datapipeline.New(nil) params := &datapipeline.CreatePipelineInput{ Name: aws.String("id"), // Required UniqueId: aws.String("id"), // Required Description: aws.String("string"), Tags: []*datapipeline.Tag{ { // Required Key: aws.String("tagKey"), // Required Value: aws.String("tagValue"), // Required }, // More values... }, } resp, err := svc.CreatePipeline(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 ExampleCloudTrail_LookupEvents() { svc := cloudtrail.New(nil) params := &cloudtrail.LookupEventsInput{ EndTime: aws.Time(time.Now()), LookupAttributes: []*cloudtrail.LookupAttribute{ { // Required AttributeKey: aws.String("LookupAttributeKey"), // Required AttributeValue: aws.String("String"), // Required }, // More values... }, MaxResults: aws.Int64(1), NextToken: aws.String("NextToken"), StartTime: aws.Time(time.Now()), } resp, err := svc.LookupEvents(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 ExampleCloudFront_CreateInvalidation() { svc := cloudfront.New(nil) params := &cloudfront.CreateInvalidationInput{ DistributionId: aws.String("string"), // Required InvalidationBatch: &cloudfront.InvalidationBatch{ // Required CallerReference: aws.String("string"), // Required Paths: &cloudfront.Paths{ // Required Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, }, } resp, err := svc.CreateInvalidation(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(nil) 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 ExampleConfigService_PutConfigurationRecorder() { svc := configservice.New(nil) params := &configservice.PutConfigurationRecorderInput{ ConfigurationRecorder: &configservice.ConfigurationRecorder{ // Required Name: aws.String("RecorderName"), RecordingGroup: &configservice.RecordingGroup{ AllSupported: aws.Bool(true), ResourceTypes: []*string{ aws.String("ResourceType"), // Required // More values... }, }, RoleARN: aws.String("String"), }, } resp, err := svc.PutConfigurationRecorder(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_DeleteObjects() { svc := s3.New(nil) 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 TestInputService3ProtocolTestListTypesCase1(t *testing.T) { svc := NewInputService3ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService3TestShapeInputShape{ ListArg: []*string{ aws.String("foo"), aws.String("bar"), aws.String("baz"), }, } req, _ := svc.InputService3TestCaseOperation1Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func ExampleS3_CompleteMultipartUpload() { svc := s3.New(nil) 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 TestInputService6ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { svc := NewInputService6ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService6TestShapeInputService6TestCaseOperation1Input{ MapArg: map[string]*string{ "key1": aws.String("val1"), "key2": aws.String("val2"), }, } req, _ := svc.InputService6TestCaseOperation1Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&MapArg.entry.1.TheKey=key1&MapArg.entry.1.TheValue=val1&MapArg.entry.2.TheKey=key2&MapArg.entry.2.TheValue=val2&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func ExampleS3_HeadObject() { svc := s3.New(nil) 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 ExampleCloudSearchDomain_Search() { svc := cloudsearchdomain.New(nil) params := &cloudsearchdomain.SearchInput{ Query: aws.String("Query"), // Required Cursor: aws.String("Cursor"), Expr: aws.String("Expr"), Facet: aws.String("Facet"), FilterQuery: aws.String("FilterQuery"), Highlight: aws.String("Highlight"), Partial: aws.Bool(true), QueryOptions: aws.String("QueryOptions"), QueryParser: aws.String("QueryParser"), Return: aws.String("Return"), Size: aws.Int64(1), Sort: aws.String("Sort"), Start: aws.Int64(1), } resp, err := svc.Search(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 ExampleCognitoIdentity_UpdateIdentityPool() { svc := cognitoidentity.New(nil) params := &cognitoidentity.IdentityPool{ AllowUnauthenticatedIdentities: aws.Bool(true), // Required IdentityPoolId: aws.String("IdentityPoolId"), // Required IdentityPoolName: aws.String("IdentityPoolName"), // Required DeveloperProviderName: aws.String("DeveloperProviderName"), OpenIdConnectProviderARNs: []*string{ aws.String("ARNString"), // Required // More values... }, SupportedLoginProviders: map[string]*string{ "Key": aws.String("IdentityProviderId"), // Required // More values... }, } resp, err := svc.UpdateIdentityPool(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) }