// return sum of 5xx errors from a given ELB func awsGetELB5XX(cw cloudwatch.CloudWatch, md *opentsdb.MultiDataPoint, loadBalancer *elb.LoadBalancerDescription) error { search := cloudwatch.GetMetricStatisticsInput{ StartTime: aws.Time(time.Now().UTC().Add(time.Second * -300)), EndTime: aws.Time(time.Now().UTC()), MetricName: aws.String("HTTPCode_Backend_5XX"), Period: &aws_period, Statistics: []*string{aws.String("Sum")}, Namespace: aws.String("AWS/ELB"), Unit: aws.String("Count"), Dimensions: []*cloudwatch.Dimension{ { Name: aws.String("LoadBalancerName"), Value: loadBalancer.LoadBalancerName, }, }, } resp, err := cw.GetMetricStatistics(&search) if err != nil { return err } for _, datapoint := range resp.Datapoints { AddTS(md, awsELBStatus5XX, datapoint.Timestamp.Unix(), *datapoint.Sum, opentsdb.TagSet{"loadbalancer": *loadBalancer.LoadBalancerName}, metadata.Gauge, metadata.Second, descAWSELBStatus5XX) } return nil }
func ExampleCloudWatch_DescribeAlarms() { svc := cloudwatch.New(nil) params := &cloudwatch.DescribeAlarmsInput{ ActionPrefix: aws.String("ActionPrefix"), AlarmNamePrefix: aws.String("AlarmNamePrefix"), AlarmNames: []*string{ aws.String("AlarmName"), // Required // More values... }, MaxRecords: aws.Int64(1), NextToken: aws.String("NextToken"), StateValue: aws.String("StateValue"), } resp, err := svc.DescribeAlarms(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 ExampleELB_CreateLoadBalancerListeners() { svc := elb.New(nil) params := &elb.CreateLoadBalancerListenersInput{ Listeners: []*elb.Listener{ // Required { // Required InstancePort: aws.Int64(1), // Required LoadBalancerPort: aws.Int64(1), // Required Protocol: aws.String("Protocol"), // Required InstanceProtocol: aws.String("Protocol"), SSLCertificateId: aws.String("SSLCertificateId"), }, // More values... }, LoadBalancerName: aws.String("AccessPointName"), // Required } resp, err := svc.CreateLoadBalancerListeners(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 ExampleAutoScaling_PutScheduledUpdateGroupAction() { svc := autoscaling.New(nil) params := &autoscaling.PutScheduledUpdateGroupActionInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required ScheduledActionName: aws.String("XmlStringMaxLen255"), // Required DesiredCapacity: aws.Int64(1), EndTime: aws.Time(time.Now()), MaxSize: aws.Int64(1), MinSize: aws.Int64(1), Recurrence: aws.String("XmlStringMaxLen255"), StartTime: aws.Time(time.Now()), Time: aws.Time(time.Now()), } resp, err := svc.PutScheduledUpdateGroupAction(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 := &InputService3TestShapeInputService3TestCaseOperation1Input{ 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 ExampleAutoScaling_PutScalingPolicy() { svc := autoscaling.New(nil) params := &autoscaling.PutScalingPolicyInput{ AdjustmentType: aws.String("XmlStringMaxLen255"), // Required AutoScalingGroupName: aws.String("ResourceName"), // Required PolicyName: aws.String("XmlStringMaxLen255"), // Required Cooldown: aws.Int64(1), EstimatedInstanceWarmup: aws.Int64(1), MetricAggregationType: aws.String("XmlStringMaxLen32"), MinAdjustmentMagnitude: aws.Int64(1), MinAdjustmentStep: aws.Int64(1), PolicyType: aws.String("XmlStringMaxLen64"), ScalingAdjustment: aws.Int64(1), StepAdjustments: []*autoscaling.StepAdjustment{ { // Required ScalingAdjustment: aws.Int64(1), // Required MetricIntervalLowerBound: aws.Float64(1.0), MetricIntervalUpperBound: aws.Float64(1.0), }, // More values... }, } resp, err := svc.PutScalingPolicy(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 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 TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) { svc := NewInputService6ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService6TestShapeInputService6TestCaseOperation1Input{ ListArg: []*string{ aws.String("a"), aws.String("b"), aws.String("c"), }, } req, _ := svc.InputService6TestCaseOperation1Request(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) assert.Equal(t, util.Trim(`Action=OperationName&ListQueryName.1=a&ListQueryName.2=b&ListQueryName.3=c&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func ExampleAutoScaling_DescribePolicies() { svc := autoscaling.New(nil) params := &autoscaling.DescribePoliciesInput{ AutoScalingGroupName: aws.String("ResourceName"), MaxRecords: aws.Int64(1), NextToken: aws.String("XmlString"), PolicyNames: []*string{ aws.String("ResourceName"), // Required // More values... }, PolicyTypes: []*string{ aws.String("XmlStringMaxLen64"), // Required // More values... }, } resp, err := svc.DescribePolicies(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 ExampleAutoScaling_DescribeTags() { svc := autoscaling.New(nil) params := &autoscaling.DescribeTagsInput{ Filters: []*autoscaling.Filter{ { // Required Name: aws.String("XmlString"), Values: []*string{ aws.String("XmlString"), // Required // More values... }, }, // More values... }, MaxRecords: aws.Int64(1), NextToken: aws.String("XmlString"), } resp, err := svc.DescribeTags(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 ExampleAutoScaling_DescribeScheduledActions() { svc := autoscaling.New(nil) params := &autoscaling.DescribeScheduledActionsInput{ AutoScalingGroupName: aws.String("ResourceName"), EndTime: aws.Time(time.Now()), MaxRecords: aws.Int64(1), NextToken: aws.String("XmlString"), ScheduledActionNames: []*string{ aws.String("ResourceName"), // Required // More values... }, StartTime: aws.Time(time.Now()), } resp, err := svc.DescribeScheduledActions(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 ExampleELB_RemoveTags() { svc := elb.New(nil) params := &elb.RemoveTagsInput{ LoadBalancerNames: []*string{ // Required aws.String("AccessPointName"), // Required // More values... }, Tags: []*elb.TagKeyOnly{ // Required { // Required Key: aws.String("TagKey"), }, // More values... }, } resp, err := svc.RemoveTags(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 ExampleELB_ConfigureHealthCheck() { svc := elb.New(nil) params := &elb.ConfigureHealthCheckInput{ HealthCheck: &elb.HealthCheck{ // Required HealthyThreshold: aws.Int64(1), // Required Interval: aws.Int64(1), // Required Target: aws.String("HealthCheckTarget"), // Required Timeout: aws.Int64(1), // Required UnhealthyThreshold: aws.Int64(1), // Required }, LoadBalancerName: aws.String("AccessPointName"), // Required } resp, err := svc.ConfigureHealthCheck(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 ExampleELB_CreateLoadBalancerPolicy() { svc := elb.New(nil) params := &elb.CreateLoadBalancerPolicyInput{ LoadBalancerName: aws.String("AccessPointName"), // Required PolicyName: aws.String("PolicyName"), // Required PolicyTypeName: aws.String("PolicyTypeName"), // Required PolicyAttributes: []*elb.PolicyAttribute{ { // Required AttributeName: aws.String("AttributeName"), AttributeValue: aws.String("AttributeValue"), }, // More values... }, } resp, err := svc.CreateLoadBalancerPolicy(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 TestInputService6ProtocolTestSerializeMapTypeCase1(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.key=key1&MapArg.entry.1.value=val1&MapArg.entry.2.key=key2&MapArg.entry.2.value=val2&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func ExampleAutoScaling_DeleteTags() { svc := autoscaling.New(nil) params := &autoscaling.DeleteTagsInput{ Tags: []*autoscaling.Tag{ // Required { // Required Key: aws.String("TagKey"), // Required PropagateAtLaunch: aws.Bool(true), ResourceId: aws.String("XmlString"), ResourceType: aws.String("XmlString"), Value: aws.String("TagValue"), }, // More values... }, } resp, err := svc.DeleteTags(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 ExampleCloudWatch_ListMetrics() { svc := cloudwatch.New(nil) params := &cloudwatch.ListMetricsInput{ Dimensions: []*cloudwatch.DimensionFilter{ { // Required Name: aws.String("DimensionName"), // Required Value: aws.String("DimensionValue"), }, // More values... }, MetricName: aws.String("MetricName"), Namespace: aws.String("Namespace"), NextToken: aws.String("NextToken"), } resp, err := svc.ListMetrics(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 TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) { svc := NewInputService2ProtocolTest(nil) svc.Endpoint = "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) assert.Equal(t, util.Trim(`Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestPresignHandler(t *testing.T) { svc := s3.New(nil) req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ Bucket: aws.String("bucket"), Key: aws.String("key"), ContentDisposition: aws.String("a+b c$d"), ACL: aws.String("public-read"), }) req.Time = time.Unix(0, 0) urlstr, err := req.Presign(5 * time.Minute) assert.NoError(t, err) expectedDate := "19700101T000000Z" expectedHeaders := "host;x-amz-acl" expectedSig := "7edcb4e3a1bf12f4989018d75acbe3a7f03df24bd6f3112602d59fc551f0e4e2" expectedCred := "AKID/19700101/mock-region/s3/aws4_request" u, _ := url.Parse(urlstr) urlQ := u.Query() assert.Equal(t, expectedSig, urlQ.Get("X-Amz-Signature")) assert.Equal(t, expectedCred, urlQ.Get("X-Amz-Credential")) assert.Equal(t, expectedHeaders, urlQ.Get("X-Amz-SignedHeaders")) assert.Equal(t, expectedDate, urlQ.Get("X-Amz-Date")) assert.Equal(t, "300", urlQ.Get("X-Amz-Expires")) assert.NotContains(t, urlstr, "+") // + encoded as %20 }
// Use DynamoDB methods for simplicity func TestPaginationEachPage(t *testing.T) { db := dynamodb.New(nil) tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false reqNum := 0 resps := []*dynamodb.ListTablesOutput{ {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")}, {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")}, {TableNames: []*string{aws.String("Table5")}}, } db.Handlers.Send.Clear() // mock sending db.Handlers.Unmarshal.Clear() db.Handlers.UnmarshalMeta.Clear() db.Handlers.ValidateResponse.Clear() db.Handlers.Build.PushBack(func(r *request.Request) { in := r.Params.(*dynamodb.ListTablesInput) if in == nil { tokens = append(tokens, "") } else if in.ExclusiveStartTableName != nil { tokens = append(tokens, *in.ExclusiveStartTableName) } }) db.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = resps[reqNum] reqNum++ }) params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} req, _ := db.ListTablesRequest(params) err := req.EachPage(func(p interface{}, last bool) bool { numPages++ for _, t := range p.(*dynamodb.ListTablesOutput).TableNames { pages = append(pages, *t) } if last { if gotToEnd { assert.Fail(t, "last=true happened twice") } gotToEnd = true } return true }) assert.Equal(t, []string{"Table2", "Table4"}, tokens) assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages) assert.Equal(t, 3, numPages) assert.True(t, gotToEnd) assert.Nil(t, err) }
func TestNoErrors(t *testing.T) { input := &StructShape{ RequiredList: []*ConditionalStructShape{}, RequiredMap: map[string]*ConditionalStructShape{ "key1": {Name: aws.String("Name")}, "key2": {Name: aws.String("Name")}, }, RequiredBool: aws.Bool(true), OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")}, } req := testSvc.NewRequest(&request.Operation{}, input, nil) corehandlers.ValidateParametersHandler.Fn(req) require.NoError(t, req.Error) }
func ExampleELB_CreateLoadBalancer() { svc := elb.New(nil) params := &elb.CreateLoadBalancerInput{ Listeners: []*elb.Listener{ // Required { // Required InstancePort: aws.Int64(1), // Required LoadBalancerPort: aws.Int64(1), // Required Protocol: aws.String("Protocol"), // Required InstanceProtocol: aws.String("Protocol"), SSLCertificateId: aws.String("SSLCertificateId"), }, // More values... }, LoadBalancerName: aws.String("AccessPointName"), // Required AvailabilityZones: []*string{ aws.String("AvailabilityZone"), // Required // More values... }, Scheme: aws.String("LoadBalancerScheme"), SecurityGroups: []*string{ aws.String("SecurityGroupId"), // Required // More values... }, Subnets: []*string{ aws.String("SubnetId"), // Required // More values... }, Tags: []*elb.Tag{ { // Required Key: aws.String("TagKey"), // Required Value: aws.String("TagValue"), }, // More values... }, } resp, err := svc.CreateLoadBalancer(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 TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { svc := NewInputService3ProtocolTest(nil) svc.Endpoint = "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) assert.Equal(t, util.Trim(`Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { server := initTestServer("2014-12-16T01:51:37Z", false) defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ Client: ec2metadata.New(&ec2metadata.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") 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.") }
// Use S3 for simplicity func TestPaginationTruncation(t *testing.T) { count := 0 client := s3.New(nil) reqNum := &count resps := []*s3.ListObjectsOutput{ {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}}, {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}}, {IsTruncated: aws.Bool(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}}, {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}}, } client.Handlers.Send.Clear() // mock sending client.Handlers.Unmarshal.Clear() client.Handlers.UnmarshalMeta.Clear() client.Handlers.ValidateResponse.Clear() client.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = resps[*reqNum] *reqNum++ }) params := &s3.ListObjectsInput{Bucket: aws.String("bucket")} results := []string{} err := client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool { results = append(results, *p.Contents[0].Key) return true }) assert.Equal(t, []string{"Key1", "Key2", "Key3"}, results) assert.Nil(t, err) // Try again without truncation token at all count = 0 resps[1].IsTruncated = nil resps[2].IsTruncated = aws.Bool(true) results = []string{} err = client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool { results = append(results, *p.Contents[0].Key) return true }) assert.Equal(t, []string{"Key1", "Key2"}, results) assert.Nil(t, err) }
func ExampleAutoScaling_PutLifecycleHook() { svc := autoscaling.New(nil) params := &autoscaling.PutLifecycleHookInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required DefaultResult: aws.String("LifecycleActionResult"), HeartbeatTimeout: aws.Int64(1), LifecycleTransition: aws.String("LifecycleTransition"), NotificationMetadata: aws.String("XmlStringMaxLen1023"), NotificationTargetARN: aws.String("ResourceName"), RoleARN: aws.String("ResourceName"), } resp, err := svc.PutLifecycleHook(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 ExampleAutoScaling_UpdateAutoScalingGroup() { svc := autoscaling.New(nil) params := &autoscaling.UpdateAutoScalingGroupInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required AvailabilityZones: []*string{ aws.String("XmlStringMaxLen255"), // Required // More values... }, DefaultCooldown: aws.Int64(1), DesiredCapacity: aws.Int64(1), HealthCheckGracePeriod: aws.Int64(1), HealthCheckType: aws.String("XmlStringMaxLen32"), LaunchConfigurationName: aws.String("ResourceName"), MaxSize: aws.Int64(1), MinSize: aws.Int64(1), PlacementGroup: aws.String("XmlStringMaxLen255"), TerminationPolicies: []*string{ aws.String("XmlStringMaxLen1600"), // Required // More values... }, VPCZoneIdentifier: aws.String("XmlStringMaxLen255"), } resp, err := svc.UpdateAutoScalingGroup(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 ExampleELB_ModifyLoadBalancerAttributes() { svc := elb.New(nil) params := &elb.ModifyLoadBalancerAttributesInput{ LoadBalancerAttributes: &elb.LoadBalancerAttributes{ // Required AccessLog: &elb.AccessLog{ Enabled: aws.Bool(true), // Required EmitInterval: aws.Int64(1), S3BucketName: aws.String("S3BucketName"), S3BucketPrefix: aws.String("AccessLogPrefix"), }, AdditionalAttributes: []*elb.AdditionalAttribute{ { // Required Key: aws.String("StringVal"), Value: aws.String("StringVal"), }, // More values... }, ConnectionDraining: &elb.ConnectionDraining{ Enabled: aws.Bool(true), // Required Timeout: aws.Int64(1), }, ConnectionSettings: &elb.ConnectionSettings{ IdleTimeout: aws.Int64(1), // Required }, CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{ Enabled: aws.Bool(true), // Required }, }, LoadBalancerName: aws.String("AccessPointName"), // Required } resp, err := svc.ModifyLoadBalancerAttributes(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 ExampleAutoScaling_DeleteLifecycleHook() { svc := autoscaling.New(nil) params := &autoscaling.DeleteLifecycleHookInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required } resp, err := svc.DeleteLifecycleHook(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 ExampleAutoScaling_DeleteScheduledAction() { svc := autoscaling.New(nil) params := &autoscaling.DeleteScheduledActionInput{ ScheduledActionName: aws.String("ResourceName"), // Required AutoScalingGroupName: aws.String("ResourceName"), } resp, err := svc.DeleteScheduledAction(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) }