Dep helper (#2151)

* Add dep task to update go dependencies

* Update go dependencies
This commit is contained in:
Manuel Alejandro de Brito Fontes 2018-09-29 19:47:07 -03:00 committed by Miek Gieben
parent 8f8b81f56b
commit 0e8977761d
764 changed files with 172 additions and 267451 deletions

View file

@ -1,35 +0,0 @@
package route53_test
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/route53"
)
func TestBuildCorrectURI(t *testing.T) {
const expectPath = "/2013-04-01/hostedzone/ABCDEFG"
svc := route53.New(unit.Session)
svc.Handlers.Validate.Clear()
req, _ := svc.GetHostedZoneRequest(&route53.GetHostedZoneInput{
Id: aws.String("/hostedzone/ABCDEFG"),
})
req.HTTPRequest.URL.RawQuery = "abc=123"
req.Build()
if a, e := req.HTTPRequest.URL.Path, expectPath; a != e {
t.Errorf("expect path %q, got %q", e, a)
}
if a, e := req.HTTPRequest.URL.RawPath, expectPath; a != e {
t.Errorf("expect raw path %q, got %q", e, a)
}
if a, e := req.HTTPRequest.URL.RawQuery, "abc=123"; a != e {
t.Errorf("expect query to be %q, got %q", e, a)
}
}

View file

@ -1,936 +0,0 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package route53_test
import (
"fmt"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/route53"
)
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 associate a VPC with a hosted zone
//
// The following example associates the VPC with ID vpc-1a2b3c4d with the hosted zone
// with ID Z3M3LMPEXAMPLE.
func ExampleRoute53_AssociateVPCWithHostedZone_shared00() {
svc := route53.New(session.New())
input := &route53.AssociateVPCWithHostedZoneInput{
Comment: aws.String(""),
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
VPC: &route53.VPC{
VPCId: aws.String("vpc-1a2b3c4d"),
VPCRegion: aws.String("us-east-2"),
},
}
result, err := svc.AssociateVPCWithHostedZone(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNotAuthorizedException:
fmt.Println(route53.ErrCodeNotAuthorizedException, aerr.Error())
case route53.ErrCodeInvalidVPCId:
fmt.Println(route53.ErrCodeInvalidVPCId, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePublicZoneVPCAssociation:
fmt.Println(route53.ErrCodePublicZoneVPCAssociation, aerr.Error())
case route53.ErrCodeConflictingDomainExists:
fmt.Println(route53.ErrCodeConflictingDomainExists, aerr.Error())
case route53.ErrCodeLimitsExceeded:
fmt.Println(route53.ErrCodeLimitsExceeded, 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 basic resource record set
//
// The following example creates a resource record set that routes Internet traffic
// to a resource with an IP address of 192.0.2.44.
func ExampleRoute53_ChangeResourceRecordSets_shared00() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.44"),
},
},
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
},
Comment: aws.String("Web server for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 weighted resource record sets
//
// The following example creates two weighted resource record sets. The resource with
// a Weight of 100 will get 1/3rd of traffic (100/100+200), and the other resource will
// get the rest of the traffic for example.com.
func ExampleRoute53_ChangeResourceRecordSets_shared01() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"),
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.44"),
},
},
SetIdentifier: aws.String("Seattle data center"),
TTL: aws.Int64(60),
Type: aws.String("A"),
Weight: aws.Int64(100),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"),
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.45"),
},
},
SetIdentifier: aws.String("Portland data center"),
TTL: aws.Int64(60),
Type: aws.String("A"),
Weight: aws.Int64(200),
},
},
},
Comment: aws.String("Web servers for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 an alias resource record set
//
// The following example creates an alias resource record set that routes traffic to
// a CloudFront distribution.
func ExampleRoute53_ChangeResourceRecordSets_shared02() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("d123rk29d0stfj.cloudfront.net"),
EvaluateTargetHealth: aws.Bool(false),
HostedZoneId: aws.String("Z2FDTNDATAQYW2"),
},
Name: aws.String("example.com"),
Type: aws.String("A"),
},
},
},
Comment: aws.String("CloudFront distribution for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 weighted alias resource record sets
//
// The following example creates two weighted alias resource record sets that route
// traffic to ELB load balancers. The resource with a Weight of 100 will get 1/3rd of
// traffic (100/100+200), and the other resource will get the rest of the traffic for
// example.com.
func ExampleRoute53_ChangeResourceRecordSets_shared03() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z3AADJGX6KTTL2"),
},
Name: aws.String("example.com"),
SetIdentifier: aws.String("Ohio region"),
Type: aws.String("A"),
Weight: aws.Int64(100),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z1H1FL5HABSF5"),
},
Name: aws.String("example.com"),
SetIdentifier: aws.String("Oregon region"),
Type: aws.String("A"),
Weight: aws.Int64(200),
},
},
},
Comment: aws.String("ELB load balancers for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 latency resource record sets
//
// The following example creates two latency resource record sets that route traffic
// to EC2 instances. Traffic for example.com is routed either to the Ohio region or
// the Oregon region, depending on the latency between the user and those regions.
func ExampleRoute53_ChangeResourceRecordSets_shared04() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"),
Name: aws.String("example.com"),
Region: aws.String("us-east-2"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.44"),
},
},
SetIdentifier: aws.String("Ohio region"),
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"),
Name: aws.String("example.com"),
Region: aws.String("us-west-2"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.45"),
},
},
SetIdentifier: aws.String("Oregon region"),
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
},
Comment: aws.String("EC2 instances for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 latency alias resource record sets
//
// The following example creates two latency alias resource record sets that route traffic
// for example.com to ELB load balancers. Requests are routed either to the Ohio region
// or the Oregon region, depending on the latency between the user and those regions.
func ExampleRoute53_ChangeResourceRecordSets_shared05() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z3AADJGX6KTTL2"),
},
Name: aws.String("example.com"),
Region: aws.String("us-east-2"),
SetIdentifier: aws.String("Ohio region"),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z1H1FL5HABSF5"),
},
Name: aws.String("example.com"),
Region: aws.String("us-west-2"),
SetIdentifier: aws.String("Oregon region"),
Type: aws.String("A"),
},
},
},
Comment: aws.String("ELB load balancers for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 failover resource record sets
//
// The following example creates primary and secondary failover resource record sets
// that route traffic to EC2 instances. Traffic is generally routed to the primary resource,
// in the Ohio region. If that resource is unavailable, traffic is routed to the secondary
// resource, in the Oregon region.
func ExampleRoute53_ChangeResourceRecordSets_shared06() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
Failover: aws.String("PRIMARY"),
HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"),
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.44"),
},
},
SetIdentifier: aws.String("Ohio region"),
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
Failover: aws.String("SECONDARY"),
HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"),
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.45"),
},
},
SetIdentifier: aws.String("Oregon region"),
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
},
Comment: aws.String("Failover configuration for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 failover alias resource record sets
//
// The following example creates primary and secondary failover alias resource record
// sets that route traffic to ELB load balancers. Traffic is generally routed to the
// primary resource, in the Ohio region. If that resource is unavailable, traffic is
// routed to the secondary resource, in the Oregon region.
func ExampleRoute53_ChangeResourceRecordSets_shared07() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z3AADJGX6KTTL2"),
},
Failover: aws.String("PRIMARY"),
Name: aws.String("example.com"),
SetIdentifier: aws.String("Ohio region"),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z1H1FL5HABSF5"),
},
Failover: aws.String("SECONDARY"),
Name: aws.String("example.com"),
SetIdentifier: aws.String("Oregon region"),
Type: aws.String("A"),
},
},
},
Comment: aws.String("Failover alias configuration for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 geolocation resource record sets
//
// The following example creates four geolocation resource record sets that use IPv4
// addresses to route traffic to resources such as web servers running on EC2 instances.
// Traffic is routed to one of four IP addresses, for North America (NA), for South
// America (SA), for Europe (EU), and for all other locations (*).
func ExampleRoute53_ChangeResourceRecordSets_shared08() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
GeoLocation: &route53.GeoLocation{
ContinentCode: aws.String("NA"),
},
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.44"),
},
},
SetIdentifier: aws.String("North America"),
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
GeoLocation: &route53.GeoLocation{
ContinentCode: aws.String("SA"),
},
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.45"),
},
},
SetIdentifier: aws.String("South America"),
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
GeoLocation: &route53.GeoLocation{
ContinentCode: aws.String("EU"),
},
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.46"),
},
},
SetIdentifier: aws.String("Europe"),
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
GeoLocation: &route53.GeoLocation{
CountryCode: aws.String("*"),
},
Name: aws.String("example.com"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("192.0.2.47"),
},
},
SetIdentifier: aws.String("Other locations"),
TTL: aws.Int64(60),
Type: aws.String("A"),
},
},
},
Comment: aws.String("Geolocation configuration for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 geolocation alias resource record sets
//
// The following example creates four geolocation alias resource record sets that route
// traffic to ELB load balancers. Traffic is routed to one of four IP addresses, for
// North America (NA), for South America (SA), for Europe (EU), and for all other locations
// (*).
func ExampleRoute53_ChangeResourceRecordSets_shared09() {
svc := route53.New(session.New())
input := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z3AADJGX6KTTL2"),
},
GeoLocation: &route53.GeoLocation{
ContinentCode: aws.String("NA"),
},
Name: aws.String("example.com"),
SetIdentifier: aws.String("North America"),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-234567890.sa-east-1.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z2P70J7HTTTPLU"),
},
GeoLocation: &route53.GeoLocation{
ContinentCode: aws.String("SA"),
},
Name: aws.String("example.com"),
SetIdentifier: aws.String("South America"),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-234567890.eu-central-1.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z215JYRZR1TBD5"),
},
GeoLocation: &route53.GeoLocation{
ContinentCode: aws.String("EU"),
},
Name: aws.String("example.com"),
SetIdentifier: aws.String("Europe"),
Type: aws.String("A"),
},
},
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("example-com-234567890.ap-southeast-1.elb.amazonaws.com "),
EvaluateTargetHealth: aws.Bool(true),
HostedZoneId: aws.String("Z1LMS91P8CMLE5"),
},
GeoLocation: &route53.GeoLocation{
CountryCode: aws.String("*"),
},
Name: aws.String("example.com"),
SetIdentifier: aws.String("Other locations"),
Type: aws.String("A"),
},
},
},
Comment: aws.String("Geolocation alias configuration for example.com"),
},
HostedZoneId: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.ChangeResourceRecordSets(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeInvalidChangeBatch:
fmt.Println(route53.ErrCodeInvalidChangeBatch, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, 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 or remove tags from a hosted zone or health check
//
// The following example adds two tags and removes one tag from the hosted zone with
// ID Z3M3LMPEXAMPLE.
func ExampleRoute53_ChangeTagsForResource_shared00() {
svc := route53.New(session.New())
input := &route53.ChangeTagsForResourceInput{
AddTags: []*route53.Tag{
{
Key: aws.String("apex"),
Value: aws.String("3874"),
},
{
Key: aws.String("acme"),
Value: aws.String("4938"),
},
},
RemoveTagKeys: []*string{
aws.String("Nadir"),
},
ResourceId: aws.String("Z3M3LMPEXAMPLE"),
ResourceType: aws.String("hostedzone"),
}
result, err := svc.ChangeTagsForResource(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, aerr.Error())
case route53.ErrCodeNoSuchHealthCheck:
fmt.Println(route53.ErrCodeNoSuchHealthCheck, aerr.Error())
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodePriorRequestNotComplete:
fmt.Println(route53.ErrCodePriorRequestNotComplete, aerr.Error())
case route53.ErrCodeThrottlingException:
fmt.Println(route53.ErrCodeThrottlingException, 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 information about a hosted zone
//
// The following example gets information about the Z3M3LMPEXAMPLE hosted zone.
func ExampleRoute53_GetHostedZone_shared00() {
svc := route53.New(session.New())
input := &route53.GetHostedZoneInput{
Id: aws.String("Z3M3LMPEXAMPLE"),
}
result, err := svc.GetHostedZone(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case route53.ErrCodeNoSuchHostedZone:
fmt.Println(route53.ErrCodeNoSuchHostedZone, aerr.Error())
case route53.ErrCodeInvalidInput:
fmt.Println(route53.ErrCodeInvalidInput, 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)
}

View file

@ -1,43 +0,0 @@
package route53
import (
"net/http"
"testing"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting"
)
func TestUnmarhsalErrorLeak(t *testing.T) {
req := &request.Request{
Operation: &request.Operation{
Name: opChangeResourceRecordSets,
},
HTTPRequest: &http.Request{
Header: make(http.Header),
Body: &awstesting.ReadCloser{Size: 2048},
},
}
req.HTTPResponse = &http.Response{
Body: &awstesting.ReadCloser{Size: 2048},
Header: http.Header{
"X-Amzn-Requestid": []string{"1"},
},
StatusCode: http.StatusOK,
}
reader := req.HTTPResponse.Body.(*awstesting.ReadCloser)
unmarshalChangeResourceRecordSetsError(req)
if req.Error == nil {
t.Error("expected an error, but received none")
}
if !reader.Closed {
t.Error("expected reader to be closed")
}
if e, a := 0, reader.Size; e != a {
t.Errorf("expected %d, but received %d", e, a)
}
}

View file

@ -1,130 +0,0 @@
package route53_test
import (
"bytes"
"io/ioutil"
"net/http"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/route53"
)
func makeClientWithResponse(response string) *route53.Route53 {
r := route53.New(unit.Session)
r.Handlers.Send.Clear()
r.Handlers.Send.PushBack(func(r *request.Request) {
body := ioutil.NopCloser(bytes.NewReader([]byte(response)))
r.HTTPResponse = &http.Response{
ContentLength: int64(len(response)),
StatusCode: 400,
Status: "Bad Request",
Body: body,
}
})
return r
}
func TestUnmarshalStandardError(t *testing.T) {
const errorResponse = `<?xml version="1.0" encoding="UTF-8"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
<Error>
<Code>InvalidDomainName</Code>
<Message>The domain name is invalid</Message>
</Error>
<RequestId>12345</RequestId>
</ErrorResponse>
`
r := makeClientWithResponse(errorResponse)
_, err := r.CreateHostedZone(&route53.CreateHostedZoneInput{
CallerReference: aws.String("test"),
Name: aws.String("test_zone"),
})
if err == nil {
t.Error("expected error, but received none")
}
if e, a := "InvalidDomainName", err.(awserr.Error).Code(); e != a {
t.Errorf("expected %s, but received %s", e, a)
}
if e, a := "The domain name is invalid", err.(awserr.Error).Message(); e != a {
t.Errorf("expected %s, but received %s", e, a)
}
}
func TestUnmarshalInvalidChangeBatch(t *testing.T) {
const errorMessage = `
Tried to create resource record set duplicate.example.com. type A,
but it already exists
`
const errorResponse = `<?xml version="1.0" encoding="UTF-8"?>
<InvalidChangeBatch xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
<Messages>
<Message>` + errorMessage + `</Message>
</Messages>
</InvalidChangeBatch>
`
r := makeClientWithResponse(errorResponse)
req := &route53.ChangeResourceRecordSetsInput{
HostedZoneId: aws.String("zoneId"),
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
Name: aws.String("domain"),
Type: aws.String("CNAME"),
TTL: aws.Int64(120),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String("cname"),
},
},
},
},
},
},
}
_, err := r.ChangeResourceRecordSets(req)
if err == nil {
t.Error("expected error, but received none")
}
if reqErr, ok := err.(awserr.RequestFailure); ok {
if reqErr == nil {
t.Error("expected error, but received none")
}
if e, a := 400, reqErr.StatusCode(); e != a {
t.Errorf("expected %d, but received %d", e, a)
}
} else {
t.Fatal("returned error is not a RequestFailure")
}
if batchErr, ok := err.(awserr.BatchedErrors); ok {
errs := batchErr.OrigErrs()
if e, a := 1, len(errs); e != a {
t.Errorf("expected %d, but received %d", e, a)
}
if e, a := "InvalidChangeBatch", errs[0].(awserr.Error).Code(); e != a {
t.Errorf("expected %s, but received %s", e, a)
}
if e, a := errorMessage, errs[0].(awserr.Error).Message(); e != a {
t.Errorf("expected %s, but received %s", e, a)
}
} else {
t.Fatal("returned error is not a BatchedErrors")
}
}

View file

@ -1,45 +0,0 @@
package sts_test
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/sts"
)
var svc = sts.New(unit.Session, &aws.Config{
Region: aws.String("mock-region"),
})
func TestUnsignedRequest_AssumeRoleWithSAML(t *testing.T) {
req, _ := svc.AssumeRoleWithSAMLRequest(&sts.AssumeRoleWithSAMLInput{
PrincipalArn: aws.String("ARN01234567890123456789"),
RoleArn: aws.String("ARN01234567890123456789"),
SAMLAssertion: aws.String("ASSERT"),
})
err := req.Sign()
if err != nil {
t.Errorf("expect no error, got %v", err)
}
if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
}
func TestUnsignedRequest_AssumeRoleWithWebIdentity(t *testing.T) {
req, _ := svc.AssumeRoleWithWebIdentityRequest(&sts.AssumeRoleWithWebIdentityInput{
RoleArn: aws.String("ARN01234567890123456789"),
RoleSessionName: aws.String("SESSION"),
WebIdentityToken: aws.String("TOKEN"),
})
err := req.Sign()
if err != nil {
t.Errorf("expect no error, got %v", err)
}
if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
}

View file

@ -1,282 +0,0 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package sts_test
import (
"fmt"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sts"
)
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 assume a role
//
func ExampleSTS_AssumeRole_shared00() {
svc := sts.New(session.New())
input := &sts.AssumeRoleInput{
DurationSeconds: aws.Int64(3600),
ExternalId: aws.String("123ABC"),
Policy: aws.String("{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Stmt1\",\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}]}"),
RoleArn: aws.String("arn:aws:iam::123456789012:role/demo"),
RoleSessionName: aws.String("Bob"),
}
result, err := svc.AssumeRole(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case sts.ErrCodeMalformedPolicyDocumentException:
fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error())
case sts.ErrCodePackedPolicyTooLargeException:
fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error())
case sts.ErrCodeRegionDisabledException:
fmt.Println(sts.ErrCodeRegionDisabledException, 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 assume a role as an OpenID Connect-federated user
//
func ExampleSTS_AssumeRoleWithWebIdentity_shared00() {
svc := sts.New(session.New())
input := &sts.AssumeRoleWithWebIdentityInput{
DurationSeconds: aws.Int64(3600),
ProviderId: aws.String("www.amazon.com"),
RoleArn: aws.String("arn:aws:iam::123456789012:role/FederatedWebIdentityRole"),
RoleSessionName: aws.String("app1"),
WebIdentityToken: aws.String("Atza%7CIQEBLjAsAhRFiXuWpUXuRvQ9PZL3GMFcYevydwIUFAHZwXZXXXXXXXXJnrulxKDHwy87oGKPznh0D6bEQZTSCzyoCtL_8S07pLpr0zMbn6w1lfVZKNTBdDansFBmtGnIsIapjI6xKR02Yc_2bQ8LZbUXSGm6Ry6_BG7PrtLZtj_dfCTj92xNGed-CrKqjG7nPBjNIL016GGvuS5gSvPRUxWES3VYfm1wl7WTI7jn-Pcb6M-buCgHhFOzTQxod27L9CqnOLio7N3gZAGpsp6n1-AJBOCJckcyXe2c6uD0srOJeZlKUm2eTDVMf8IehDVI0r1QOnTV6KzzAI3OY87Vd_cVMQ"),
}
result, err := svc.AssumeRoleWithWebIdentity(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case sts.ErrCodeMalformedPolicyDocumentException:
fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error())
case sts.ErrCodePackedPolicyTooLargeException:
fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error())
case sts.ErrCodeIDPRejectedClaimException:
fmt.Println(sts.ErrCodeIDPRejectedClaimException, aerr.Error())
case sts.ErrCodeIDPCommunicationErrorException:
fmt.Println(sts.ErrCodeIDPCommunicationErrorException, aerr.Error())
case sts.ErrCodeInvalidIdentityTokenException:
fmt.Println(sts.ErrCodeInvalidIdentityTokenException, aerr.Error())
case sts.ErrCodeExpiredTokenException:
fmt.Println(sts.ErrCodeExpiredTokenException, aerr.Error())
case sts.ErrCodeRegionDisabledException:
fmt.Println(sts.ErrCodeRegionDisabledException, 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 decode information about an authorization status of a request
//
func ExampleSTS_DecodeAuthorizationMessage_shared00() {
svc := sts.New(session.New())
input := &sts.DecodeAuthorizationMessageInput{
EncodedMessage: aws.String("<encoded-message>"),
}
result, err := svc.DecodeAuthorizationMessage(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case sts.ErrCodeInvalidAuthorizationMessageException:
fmt.Println(sts.ErrCodeInvalidAuthorizationMessageException, 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 details about a calling IAM user
//
// This example shows a request and response made with the credentials for a user named
// Alice in the AWS account 123456789012.
func ExampleSTS_GetCallerIdentity_shared00() {
svc := sts.New(session.New())
input := &sts.GetCallerIdentityInput{}
result, err := svc.GetCallerIdentity(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To get details about a calling user federated with AssumeRole
//
// This example shows a request and response made with temporary credentials created
// by AssumeRole. The name of the assumed role is my-role-name, and the RoleSessionName
// is set to my-role-session-name.
func ExampleSTS_GetCallerIdentity_shared01() {
svc := sts.New(session.New())
input := &sts.GetCallerIdentityInput{}
result, err := svc.GetCallerIdentity(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To get details about a calling user federated with GetFederationToken
//
// This example shows a request and response made with temporary credentials created
// by using GetFederationToken. The Name parameter is set to my-federated-user-name.
func ExampleSTS_GetCallerIdentity_shared02() {
svc := sts.New(session.New())
input := &sts.GetCallerIdentityInput{}
result, err := svc.GetCallerIdentity(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To get temporary credentials for a role by using GetFederationToken
//
func ExampleSTS_GetFederationToken_shared00() {
svc := sts.New(session.New())
input := &sts.GetFederationTokenInput{
DurationSeconds: aws.Int64(3600),
Name: aws.String("Bob"),
Policy: aws.String("{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Stmt1\",\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}]}"),
}
result, err := svc.GetFederationToken(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case sts.ErrCodeMalformedPolicyDocumentException:
fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error())
case sts.ErrCodePackedPolicyTooLargeException:
fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error())
case sts.ErrCodeRegionDisabledException:
fmt.Println(sts.ErrCodeRegionDisabledException, 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 temporary credentials for an IAM user or an AWS account
//
func ExampleSTS_GetSessionToken_shared00() {
svc := sts.New(session.New())
input := &sts.GetSessionTokenInput{
DurationSeconds: aws.Int64(3600),
SerialNumber: aws.String("YourMFASerialNumber"),
TokenCode: aws.String("123456"),
}
result, err := svc.GetSessionToken(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case sts.ErrCodeRegionDisabledException:
fmt.Println(sts.ErrCodeRegionDisabledException, 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)
}