Update vendored deps, including AWS SDK, openpgp, ftp, ...

This commit is contained in:
Andrey Smirnov
2018-04-05 17:46:45 +03:00
parent cef4fefc40
commit 0e6ee35942
1497 changed files with 450721 additions and 68034 deletions
+1160 -362
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -10,7 +10,7 @@
//
// Using the Client
//
// To Amazon Route 53 with the SDK use the New function to create
// To contact Amazon Route 53 with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
+76 -12
View File
@@ -22,7 +22,8 @@ const (
// have any common name servers. You tried to create a hosted zone that has
// the same name as an existing hosted zone or that's the parent or child
// of an existing hosted zone, and you specified a delegation set that shares
// one or more name servers with the existing hosted zone.
// one or more name servers with the existing hosted zone. For more information,
// see CreateReusableDelegationSet.
//
// * Private hosted zone: You specified an Amazon VPC that you're already
// using for another hosted zone, and the domain that you specified for one
@@ -122,6 +123,12 @@ const (
// The specified HostedZone can't be found.
ErrCodeHostedZoneNotFound = "HostedZoneNotFound"
// ErrCodeHostedZoneNotPrivate for service response error code
// "HostedZoneNotPrivate".
//
// The specified hosted zone is a public hosted zone, not a private hosted zone.
ErrCodeHostedZoneNotPrivate = "HostedZoneNotPrivate"
// ErrCodeIncompatibleVersion for service response error code
// "IncompatibleVersion".
//
@@ -201,7 +208,14 @@ const (
// ErrCodeLimitsExceeded for service response error code
// "LimitsExceeded".
//
// The limits specified for a resource have been exceeded.
// This operation can't be completed either because the current account has
// reached the limit on reusable delegation sets that it can create or because
// you've reached the limit on the number of Amazon VPCs that you can associate
// with a private hosted zone. To get the current limit on the number of reusable
// delegation sets, see GetAccountLimit. To get the current limit on the number
// of Amazon VPCs that you can associate with a private hosted zone, see GetHostedZoneLimit.
// To request a higher limit, create a case (http://aws.amazon.com/route53-request)
// with the AWS Support Center.
ErrCodeLimitsExceeded = "LimitsExceeded"
// ErrCodeNoSuchChange for service response error code
@@ -299,35 +313,85 @@ const (
// ErrCodeTooManyHealthChecks for service response error code
// "TooManyHealthChecks".
//
// This health check can't be created because the current account has reached
// the limit on the number of active health checks.
//
// For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html)
// in the Amazon Route 53 Developer Guide.
//
// For information about how to get the current limit for an account, see GetAccountLimit.
// To request a higher limit, create a case (http://aws.amazon.com/route53-request)
// with the AWS Support Center.
//
// You have reached the maximum number of active health checks for an AWS account.
// The default limit is 100. To request a higher limit, create a case (http://aws.amazon.com/route53-request)
// To request a higher limit, create a case (http://aws.amazon.com/route53-request)
// with the AWS Support Center.
ErrCodeTooManyHealthChecks = "TooManyHealthChecks"
// ErrCodeTooManyHostedZones for service response error code
// "TooManyHostedZones".
//
// This hosted zone can't be created because the hosted zone limit is exceeded.
// To request a limit increase, go to the Amazon Route 53 Contact Us (http://aws.amazon.com/route53-request/)
// page.
// This operation can't be completed either because the current account has
// reached the limit on the number of hosted zones or because you've reached
// the limit on the number of hosted zones that can be associated with a reusable
// delegation set.
//
// For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html)
// in the Amazon Route 53 Developer Guide.
//
// To get the current limit on hosted zones that can be created by an account,
// see GetAccountLimit.
//
// To get the current limit on hosted zones that can be associated with a reusable
// delegation set, see GetReusableDelegationSetLimit.
//
// To request a higher limit, create a case (http://aws.amazon.com/route53-request)
// with the AWS Support Center.
ErrCodeTooManyHostedZones = "TooManyHostedZones"
// ErrCodeTooManyTrafficPolicies for service response error code
// "TooManyTrafficPolicies".
//
// You've created the maximum number of traffic policies that can be created
// for the current AWS account. You can request an increase to the limit on
// the Contact Us (http://aws.amazon.com/route53-request/) page.
// This traffic policy can't be created because the current account has reached
// the limit on the number of traffic policies.
//
// For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html)
// in the Amazon Route 53 Developer Guide.
//
// To get the current limit for an account, see GetAccountLimit.
//
// To request a higher limit, create a case (http://aws.amazon.com/route53-request)
// with the AWS Support Center.
ErrCodeTooManyTrafficPolicies = "TooManyTrafficPolicies"
// ErrCodeTooManyTrafficPolicyInstances for service response error code
// "TooManyTrafficPolicyInstances".
//
// You've created the maximum number of traffic policy instances that can be
// created for the current AWS account. You can request an increase to the limit
// on the Contact Us (http://aws.amazon.com/route53-request/) page.
// This traffic policy instance can't be created because the current account
// has reached the limit on the number of traffic policy instances.
//
// For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html)
// in the Amazon Route 53 Developer Guide.
//
// For information about how to get the current limit for an account, see GetAccountLimit.
//
// To request a higher limit, create a case (http://aws.amazon.com/route53-request)
// with the AWS Support Center.
ErrCodeTooManyTrafficPolicyInstances = "TooManyTrafficPolicyInstances"
// ErrCodeTooManyTrafficPolicyVersionsForCurrentPolicy for service response error code
// "TooManyTrafficPolicyVersionsForCurrentPolicy".
//
// This traffic policy version can't be created because you've reached the limit
// of 1000 on the number of versions that you can create for the current traffic
// policy.
//
// To create more traffic policy versions, you can use GetTrafficPolicy to get
// the traffic policy document for a specified traffic policy version, and then
// use CreateTrafficPolicy to create a new traffic policy using the traffic
// policy document.
ErrCodeTooManyTrafficPolicyVersionsForCurrentPolicy = "TooManyTrafficPolicyVersionsForCurrentPolicy"
// ErrCodeTooManyVPCAssociationAuthorizations for service response error code
// "TooManyVPCAssociationAuthorizations".
//
+271
View File
@@ -83,6 +83,16 @@ func ExampleRoute53_ChangeResourceRecordSets_shared00() {
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"),
@@ -130,9 +140,35 @@ func ExampleRoute53_ChangeResourceRecordSets_shared01() {
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"),
@@ -179,6 +215,15 @@ func ExampleRoute53_ChangeResourceRecordSets_shared02() {
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"),
@@ -227,9 +272,31 @@ func ExampleRoute53_ChangeResourceRecordSets_shared03() {
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"),
@@ -277,9 +344,35 @@ func ExampleRoute53_ChangeResourceRecordSets_shared04() {
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"),
@@ -327,9 +420,31 @@ func ExampleRoute53_ChangeResourceRecordSets_shared05() {
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"),
@@ -378,9 +493,35 @@ func ExampleRoute53_ChangeResourceRecordSets_shared06() {
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"),
@@ -429,9 +570,31 @@ func ExampleRoute53_ChangeResourceRecordSets_shared07() {
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"),
@@ -480,15 +643,71 @@ func ExampleRoute53_ChangeResourceRecordSets_shared08() {
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"),
@@ -537,15 +756,67 @@ func ExampleRoute53_ChangeResourceRecordSets_shared09() {
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"),
@@ -136,6 +136,10 @@ type Route53API interface {
DisassociateVPCFromHostedZoneWithContext(aws.Context, *route53.DisassociateVPCFromHostedZoneInput, ...request.Option) (*route53.DisassociateVPCFromHostedZoneOutput, error)
DisassociateVPCFromHostedZoneRequest(*route53.DisassociateVPCFromHostedZoneInput) (*request.Request, *route53.DisassociateVPCFromHostedZoneOutput)
GetAccountLimit(*route53.GetAccountLimitInput) (*route53.GetAccountLimitOutput, error)
GetAccountLimitWithContext(aws.Context, *route53.GetAccountLimitInput, ...request.Option) (*route53.GetAccountLimitOutput, error)
GetAccountLimitRequest(*route53.GetAccountLimitInput) (*request.Request, *route53.GetAccountLimitOutput)
GetChange(*route53.GetChangeInput) (*route53.GetChangeOutput, error)
GetChangeWithContext(aws.Context, *route53.GetChangeInput, ...request.Option) (*route53.GetChangeOutput, error)
GetChangeRequest(*route53.GetChangeInput) (*request.Request, *route53.GetChangeOutput)
@@ -172,6 +176,10 @@ type Route53API interface {
GetHostedZoneCountWithContext(aws.Context, *route53.GetHostedZoneCountInput, ...request.Option) (*route53.GetHostedZoneCountOutput, error)
GetHostedZoneCountRequest(*route53.GetHostedZoneCountInput) (*request.Request, *route53.GetHostedZoneCountOutput)
GetHostedZoneLimit(*route53.GetHostedZoneLimitInput) (*route53.GetHostedZoneLimitOutput, error)
GetHostedZoneLimitWithContext(aws.Context, *route53.GetHostedZoneLimitInput, ...request.Option) (*route53.GetHostedZoneLimitOutput, error)
GetHostedZoneLimitRequest(*route53.GetHostedZoneLimitInput) (*request.Request, *route53.GetHostedZoneLimitOutput)
GetQueryLoggingConfig(*route53.GetQueryLoggingConfigInput) (*route53.GetQueryLoggingConfigOutput, error)
GetQueryLoggingConfigWithContext(aws.Context, *route53.GetQueryLoggingConfigInput, ...request.Option) (*route53.GetQueryLoggingConfigOutput, error)
GetQueryLoggingConfigRequest(*route53.GetQueryLoggingConfigInput) (*request.Request, *route53.GetQueryLoggingConfigOutput)
@@ -180,6 +188,10 @@ type Route53API interface {
GetReusableDelegationSetWithContext(aws.Context, *route53.GetReusableDelegationSetInput, ...request.Option) (*route53.GetReusableDelegationSetOutput, error)
GetReusableDelegationSetRequest(*route53.GetReusableDelegationSetInput) (*request.Request, *route53.GetReusableDelegationSetOutput)
GetReusableDelegationSetLimit(*route53.GetReusableDelegationSetLimitInput) (*route53.GetReusableDelegationSetLimitOutput, error)
GetReusableDelegationSetLimitWithContext(aws.Context, *route53.GetReusableDelegationSetLimitInput, ...request.Option) (*route53.GetReusableDelegationSetLimitOutput, error)
GetReusableDelegationSetLimitRequest(*route53.GetReusableDelegationSetLimitInput) (*request.Request, *route53.GetReusableDelegationSetLimitOutput)
GetTrafficPolicy(*route53.GetTrafficPolicyInput) (*route53.GetTrafficPolicyOutput, error)
GetTrafficPolicyWithContext(aws.Context, *route53.GetTrafficPolicyInput, ...request.Option) (*route53.GetTrafficPolicyOutput, error)
GetTrafficPolicyRequest(*route53.GetTrafficPolicyInput) (*request.Request, *route53.GetTrafficPolicyOutput)
@@ -4,8 +4,6 @@ import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting"
)
@@ -31,7 +29,15 @@ func TestUnmarhsalErrorLeak(t *testing.T) {
reader := req.HTTPResponse.Body.(*awstesting.ReadCloser)
unmarshalChangeResourceRecordSetsError(req)
assert.NotNil(t, req.Error)
assert.Equal(t, reader.Closed, true)
assert.Equal(t, reader.Size, 0)
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)
}
}
+32 -13
View File
@@ -6,8 +6,6 @@ import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
@@ -49,9 +47,17 @@ func TestUnmarshalStandardError(t *testing.T) {
Name: aws.String("test_zone"),
})
assert.Error(t, err)
assert.Equal(t, "InvalidDomainName", err.(awserr.Error).Code())
assert.Equal(t, "The domain name is invalid", err.(awserr.Error).Message())
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) {
@@ -91,21 +97,34 @@ but it already exists
}
_, err := r.ChangeResourceRecordSets(req)
assert.Error(t, err)
if err == nil {
t.Error("expected error, but received none")
}
if reqErr, ok := err.(awserr.RequestFailure); ok {
assert.Error(t, reqErr)
assert.Equal(t, 400, reqErr.StatusCode())
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 {
assert.Fail(t, "returned error is not a RequestFailure")
t.Fatal("returned error is not a RequestFailure")
}
if batchErr, ok := err.(awserr.BatchedErrors); ok {
errs := batchErr.OrigErrs()
assert.Len(t, errs, 1)
assert.Equal(t, "InvalidChangeBatch", errs[0].(awserr.Error).Code())
assert.Equal(t, errorMessage, errs[0].(awserr.Error).Message())
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 {
assert.Fail(t, "returned error is not a BatchedErrors")
t.Fatal("returned error is not a BatchedErrors")
}
}