Add route53 plugin (#1390)

* Update vendor

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add route53 plugin

This fix adds route53 plugin so that it is possible to
query route53 record through CoreDNS.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2018-01-15 09:59:29 -08:00 committed by GitHub
parent d699b89063
commit 584dd87c70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
352 changed files with 81636 additions and 1798 deletions

5
vendor/github.com/aws/aws-sdk-go/service/generate.go generated vendored Normal file
View file

@ -0,0 +1,5 @@
// Package service contains automatically generated AWS clients.
package service
//go:generate go run -tags codegen ../private/model/cli/gen-api/main.go -path=../service ../models/apis/*/*/api-2.json
//go:generate gofmt -s -w ../service

15101
vendor/github.com/aws/aws-sdk-go/service/route53/api.go generated vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
package route53
import (
"net/url"
"regexp"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol/restxml"
)
func init() {
initClient = func(c *client.Client) {
c.Handlers.Build.PushBack(sanitizeURL)
}
initRequest = func(r *request.Request) {
switch r.Operation.Name {
case opChangeResourceRecordSets:
r.Handlers.UnmarshalError.Remove(restxml.UnmarshalErrorHandler)
r.Handlers.UnmarshalError.PushBack(unmarshalChangeResourceRecordSetsError)
}
}
}
var reSanitizeURL = regexp.MustCompile(`\/%2F\w+%2F`)
func sanitizeURL(r *request.Request) {
r.HTTPRequest.URL.RawPath =
reSanitizeURL.ReplaceAllString(r.HTTPRequest.URL.RawPath, "/")
// Update Path so that it reflects the cleaned RawPath
updated, err := url.Parse(r.HTTPRequest.URL.RawPath)
if err != nil {
r.Error = awserr.New("SerializationError", "failed to clean Route53 URL", err)
return
}
// Take the updated path so the requests's URL Path has parity with RawPath.
r.HTTPRequest.URL.Path = updated.Path
}

View file

@ -0,0 +1,35 @@
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

@ -0,0 +1,26 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package route53 provides the client and types for making API
// requests to Amazon Route 53.
//
// See https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01 for more information on this service.
//
// See route53 package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/route53/
//
// Using the Client
//
// 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.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Route 53 client Route53 for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/route53/#New
package route53

View file

@ -0,0 +1,436 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package route53
const (
// ErrCodeConcurrentModification for service response error code
// "ConcurrentModification".
//
// Another user submitted a request to create, update, or delete the object
// at the same time that you did. Retry the request.
ErrCodeConcurrentModification = "ConcurrentModification"
// ErrCodeConflictingDomainExists for service response error code
// "ConflictingDomainExists".
//
// The cause of this error depends on whether you're trying to create a public
// or a private hosted zone:
//
// * Public hosted zone: Two hosted zones that have the same name or that
// have a parent/child relationship (example.com and test.example.com) can't
// 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. 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
// of the hosted zones is a subdomain of the domain that you specified for
// the other hosted zone. For example, you can't use the same Amazon VPC
// for the hosted zones for example.com and test.example.com.
ErrCodeConflictingDomainExists = "ConflictingDomainExists"
// ErrCodeConflictingTypes for service response error code
// "ConflictingTypes".
//
// You tried to update a traffic policy instance by using a traffic policy version
// that has a different DNS type than the current type for the instance. You
// specified the type in the JSON document in the CreateTrafficPolicy or CreateTrafficPolicyVersionrequest.
ErrCodeConflictingTypes = "ConflictingTypes"
// ErrCodeDelegationSetAlreadyCreated for service response error code
// "DelegationSetAlreadyCreated".
//
// A delegation set with the same owner and caller reference combination has
// already been created.
ErrCodeDelegationSetAlreadyCreated = "DelegationSetAlreadyCreated"
// ErrCodeDelegationSetAlreadyReusable for service response error code
// "DelegationSetAlreadyReusable".
//
// The specified delegation set has already been marked as reusable.
ErrCodeDelegationSetAlreadyReusable = "DelegationSetAlreadyReusable"
// ErrCodeDelegationSetInUse for service response error code
// "DelegationSetInUse".
//
// The specified delegation contains associated hosted zones which must be deleted
// before the reusable delegation set can be deleted.
ErrCodeDelegationSetInUse = "DelegationSetInUse"
// ErrCodeDelegationSetNotAvailable for service response error code
// "DelegationSetNotAvailable".
//
// You can create a hosted zone that has the same name as an existing hosted
// zone (example.com is common), but there is a limit to the number of hosted
// zones that have the same name. If you get this error, Amazon Route 53 has
// reached that limit. If you own the domain name and Amazon Route 53 generates
// this error, contact Customer Support.
ErrCodeDelegationSetNotAvailable = "DelegationSetNotAvailable"
// ErrCodeDelegationSetNotReusable for service response error code
// "DelegationSetNotReusable".
//
// A reusable delegation set with the specified ID does not exist.
ErrCodeDelegationSetNotReusable = "DelegationSetNotReusable"
// ErrCodeHealthCheckAlreadyExists for service response error code
// "HealthCheckAlreadyExists".
//
// The health check you're attempting to create already exists. Amazon Route
// 53 returns this error when you submit a request that has the following values:
//
// * The same value for CallerReference as an existing health check, and
// one or more values that differ from the existing health check that has
// the same caller reference.
//
// * The same value for CallerReference as a health check that you created
// and later deleted, regardless of the other settings in the request.
ErrCodeHealthCheckAlreadyExists = "HealthCheckAlreadyExists"
// ErrCodeHealthCheckInUse for service response error code
// "HealthCheckInUse".
//
// This error code is not in use.
ErrCodeHealthCheckInUse = "HealthCheckInUse"
// ErrCodeHealthCheckVersionMismatch for service response error code
// "HealthCheckVersionMismatch".
//
// The value of HealthCheckVersion in the request doesn't match the value of
// HealthCheckVersion in the health check.
ErrCodeHealthCheckVersionMismatch = "HealthCheckVersionMismatch"
// ErrCodeHostedZoneAlreadyExists for service response error code
// "HostedZoneAlreadyExists".
//
// The hosted zone you're trying to create already exists. Amazon Route 53 returns
// this error when a hosted zone has already been created with the specified
// CallerReference.
ErrCodeHostedZoneAlreadyExists = "HostedZoneAlreadyExists"
// ErrCodeHostedZoneNotEmpty for service response error code
// "HostedZoneNotEmpty".
//
// The hosted zone contains resource records that are not SOA or NS records.
ErrCodeHostedZoneNotEmpty = "HostedZoneNotEmpty"
// ErrCodeHostedZoneNotFound for service response error code
// "HostedZoneNotFound".
//
// 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".
//
// The resource you're trying to access is unsupported on this Amazon Route
// 53 endpoint.
ErrCodeIncompatibleVersion = "IncompatibleVersion"
// ErrCodeInsufficientCloudWatchLogsResourcePolicy for service response error code
// "InsufficientCloudWatchLogsResourcePolicy".
//
// Amazon Route 53 doesn't have the permissions required to create log streams
// and send query logs to log streams. Possible causes include the following:
//
// * There is no resource policy that specifies the log group ARN in the
// value for Resource.
//
// * The resource policy that includes the log group ARN in the value for
// Resource doesn't have the necessary permissions.
//
// * The resource policy hasn't finished propagating yet.
ErrCodeInsufficientCloudWatchLogsResourcePolicy = "InsufficientCloudWatchLogsResourcePolicy"
// ErrCodeInvalidArgument for service response error code
// "InvalidArgument".
//
// Parameter name is invalid.
ErrCodeInvalidArgument = "InvalidArgument"
// ErrCodeInvalidChangeBatch for service response error code
// "InvalidChangeBatch".
//
// This exception contains a list of messages that might contain one or more
// error messages. Each error message indicates one error in the change batch.
ErrCodeInvalidChangeBatch = "InvalidChangeBatch"
// ErrCodeInvalidDomainName for service response error code
// "InvalidDomainName".
//
// The specified domain name is not valid.
ErrCodeInvalidDomainName = "InvalidDomainName"
// ErrCodeInvalidInput for service response error code
// "InvalidInput".
//
// The input is not valid.
ErrCodeInvalidInput = "InvalidInput"
// ErrCodeInvalidPaginationToken for service response error code
// "InvalidPaginationToken".
//
// The value that you specified to get the second or subsequent page of results
// is invalid.
ErrCodeInvalidPaginationToken = "InvalidPaginationToken"
// ErrCodeInvalidTrafficPolicyDocument for service response error code
// "InvalidTrafficPolicyDocument".
//
// The format of the traffic policy document that you specified in the Document
// element is invalid.
ErrCodeInvalidTrafficPolicyDocument = "InvalidTrafficPolicyDocument"
// ErrCodeInvalidVPCId for service response error code
// "InvalidVPCId".
//
// The VPC ID that you specified either isn't a valid ID or the current account
// is not authorized to access this VPC.
ErrCodeInvalidVPCId = "InvalidVPCId"
// ErrCodeLastVPCAssociation for service response error code
// "LastVPCAssociation".
//
// The VPC that you're trying to disassociate from the private hosted zone is
// the last VPC that is associated with the hosted zone. Amazon Route 53 doesn't
// support disassociating the last VPC from a hosted zone.
ErrCodeLastVPCAssociation = "LastVPCAssociation"
// ErrCodeLimitsExceeded for service response error code
// "LimitsExceeded".
//
// 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
// "NoSuchChange".
//
// A change with the specified change ID does not exist.
ErrCodeNoSuchChange = "NoSuchChange"
// ErrCodeNoSuchCloudWatchLogsLogGroup for service response error code
// "NoSuchCloudWatchLogsLogGroup".
//
// There is no CloudWatch Logs log group with the specified ARN.
ErrCodeNoSuchCloudWatchLogsLogGroup = "NoSuchCloudWatchLogsLogGroup"
// ErrCodeNoSuchDelegationSet for service response error code
// "NoSuchDelegationSet".
//
// A reusable delegation set with the specified ID does not exist.
ErrCodeNoSuchDelegationSet = "NoSuchDelegationSet"
// ErrCodeNoSuchGeoLocation for service response error code
// "NoSuchGeoLocation".
//
// Amazon Route 53 doesn't support the specified geolocation.
ErrCodeNoSuchGeoLocation = "NoSuchGeoLocation"
// ErrCodeNoSuchHealthCheck for service response error code
// "NoSuchHealthCheck".
//
// No health check exists with the ID that you specified in the DeleteHealthCheck
// request.
ErrCodeNoSuchHealthCheck = "NoSuchHealthCheck"
// ErrCodeNoSuchHostedZone for service response error code
// "NoSuchHostedZone".
//
// No hosted zone exists with the ID that you specified.
ErrCodeNoSuchHostedZone = "NoSuchHostedZone"
// ErrCodeNoSuchQueryLoggingConfig for service response error code
// "NoSuchQueryLoggingConfig".
//
// There is no DNS query logging configuration with the specified ID.
ErrCodeNoSuchQueryLoggingConfig = "NoSuchQueryLoggingConfig"
// ErrCodeNoSuchTrafficPolicy for service response error code
// "NoSuchTrafficPolicy".
//
// No traffic policy exists with the specified ID.
ErrCodeNoSuchTrafficPolicy = "NoSuchTrafficPolicy"
// ErrCodeNoSuchTrafficPolicyInstance for service response error code
// "NoSuchTrafficPolicyInstance".
//
// No traffic policy instance exists with the specified ID.
ErrCodeNoSuchTrafficPolicyInstance = "NoSuchTrafficPolicyInstance"
// ErrCodeNotAuthorizedException for service response error code
// "NotAuthorizedException".
//
// Associating the specified VPC with the specified hosted zone has not been
// authorized.
ErrCodeNotAuthorizedException = "NotAuthorizedException"
// ErrCodePriorRequestNotComplete for service response error code
// "PriorRequestNotComplete".
//
// If Amazon Route 53 can't process a request before the next request arrives,
// it will reject subsequent requests for the same hosted zone and return an
// HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly
// for the same request, we recommend that you wait, in intervals of increasing
// duration, before you try the request again.
ErrCodePriorRequestNotComplete = "PriorRequestNotComplete"
// ErrCodePublicZoneVPCAssociation for service response error code
// "PublicZoneVPCAssociation".
//
// You're trying to associate a VPC with a public hosted zone. Amazon Route
// 53 doesn't support associating a VPC with a public hosted zone.
ErrCodePublicZoneVPCAssociation = "PublicZoneVPCAssociation"
// ErrCodeQueryLoggingConfigAlreadyExists for service response error code
// "QueryLoggingConfigAlreadyExists".
//
// You can create only one query logging configuration for a hosted zone, and
// a query logging configuration already exists for this hosted zone.
ErrCodeQueryLoggingConfigAlreadyExists = "QueryLoggingConfigAlreadyExists"
// ErrCodeThrottlingException for service response error code
// "ThrottlingException".
//
// The limit on the number of requests per second was exceeded.
ErrCodeThrottlingException = "ThrottlingException"
// 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.
// 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 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".
//
// 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".
//
// 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".
//
// You've created the maximum number of authorizations that can be created for
// the specified hosted zone. To authorize another VPC to be associated with
// the hosted zone, submit a DeleteVPCAssociationAuthorization request to remove
// an existing authorization. To get a list of existing authorizations, submit
// a ListVPCAssociationAuthorizations request.
ErrCodeTooManyVPCAssociationAuthorizations = "TooManyVPCAssociationAuthorizations"
// ErrCodeTrafficPolicyAlreadyExists for service response error code
// "TrafficPolicyAlreadyExists".
//
// A traffic policy that has the same value for Name already exists.
ErrCodeTrafficPolicyAlreadyExists = "TrafficPolicyAlreadyExists"
// ErrCodeTrafficPolicyInUse for service response error code
// "TrafficPolicyInUse".
//
// One or more traffic policy instances were created by using the specified
// traffic policy.
ErrCodeTrafficPolicyInUse = "TrafficPolicyInUse"
// ErrCodeTrafficPolicyInstanceAlreadyExists for service response error code
// "TrafficPolicyInstanceAlreadyExists".
//
// There is already a traffic policy instance with the specified ID.
ErrCodeTrafficPolicyInstanceAlreadyExists = "TrafficPolicyInstanceAlreadyExists"
// ErrCodeVPCAssociationAuthorizationNotFound for service response error code
// "VPCAssociationAuthorizationNotFound".
//
// The VPC that you specified is not authorized to be associated with the hosted
// zone.
ErrCodeVPCAssociationAuthorizationNotFound = "VPCAssociationAuthorizationNotFound"
// ErrCodeVPCAssociationNotFound for service response error code
// "VPCAssociationNotFound".
//
// The specified VPC and hosted zone are not currently associated.
ErrCodeVPCAssociationNotFound = "VPCAssociationNotFound"
)

View file

@ -0,0 +1,665 @@
// 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"),
},
},
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"),
},
{
Action: aws.String("CREATE"),
},
},
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"),
},
},
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"),
},
{
Action: aws.String("CREATE"),
},
},
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"),
},
{
Action: aws.String("CREATE"),
},
},
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"),
},
{
Action: aws.String("CREATE"),
},
},
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"),
},
{
Action: aws.String("CREATE"),
},
},
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"),
},
{
Action: aws.String("CREATE"),
},
},
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"),
},
{
Action: aws.String("CREATE"),
},
{
Action: aws.String("CREATE"),
},
{
Action: aws.String("CREATE"),
},
},
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"),
},
{
Action: aws.String("CREATE"),
},
{
Action: aws.String("CREATE"),
},
{
Action: aws.String("CREATE"),
},
},
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

@ -0,0 +1,300 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package route53iface provides an interface to enable mocking the Amazon Route 53 service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package route53iface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/route53"
)
// Route53API provides an interface to enable mocking the
// route53.Route53 service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Route 53.
// func myFunc(svc route53iface.Route53API) bool {
// // Make svc.AssociateVPCWithHostedZone request
// }
//
// func main() {
// sess := session.New()
// svc := route53.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockRoute53Client struct {
// route53iface.Route53API
// }
// func (m *mockRoute53Client) AssociateVPCWithHostedZone(input *route53.AssociateVPCWithHostedZoneInput) (*route53.AssociateVPCWithHostedZoneOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockRoute53Client{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type Route53API interface {
AssociateVPCWithHostedZone(*route53.AssociateVPCWithHostedZoneInput) (*route53.AssociateVPCWithHostedZoneOutput, error)
AssociateVPCWithHostedZoneWithContext(aws.Context, *route53.AssociateVPCWithHostedZoneInput, ...request.Option) (*route53.AssociateVPCWithHostedZoneOutput, error)
AssociateVPCWithHostedZoneRequest(*route53.AssociateVPCWithHostedZoneInput) (*request.Request, *route53.AssociateVPCWithHostedZoneOutput)
ChangeResourceRecordSets(*route53.ChangeResourceRecordSetsInput) (*route53.ChangeResourceRecordSetsOutput, error)
ChangeResourceRecordSetsWithContext(aws.Context, *route53.ChangeResourceRecordSetsInput, ...request.Option) (*route53.ChangeResourceRecordSetsOutput, error)
ChangeResourceRecordSetsRequest(*route53.ChangeResourceRecordSetsInput) (*request.Request, *route53.ChangeResourceRecordSetsOutput)
ChangeTagsForResource(*route53.ChangeTagsForResourceInput) (*route53.ChangeTagsForResourceOutput, error)
ChangeTagsForResourceWithContext(aws.Context, *route53.ChangeTagsForResourceInput, ...request.Option) (*route53.ChangeTagsForResourceOutput, error)
ChangeTagsForResourceRequest(*route53.ChangeTagsForResourceInput) (*request.Request, *route53.ChangeTagsForResourceOutput)
CreateHealthCheck(*route53.CreateHealthCheckInput) (*route53.CreateHealthCheckOutput, error)
CreateHealthCheckWithContext(aws.Context, *route53.CreateHealthCheckInput, ...request.Option) (*route53.CreateHealthCheckOutput, error)
CreateHealthCheckRequest(*route53.CreateHealthCheckInput) (*request.Request, *route53.CreateHealthCheckOutput)
CreateHostedZone(*route53.CreateHostedZoneInput) (*route53.CreateHostedZoneOutput, error)
CreateHostedZoneWithContext(aws.Context, *route53.CreateHostedZoneInput, ...request.Option) (*route53.CreateHostedZoneOutput, error)
CreateHostedZoneRequest(*route53.CreateHostedZoneInput) (*request.Request, *route53.CreateHostedZoneOutput)
CreateQueryLoggingConfig(*route53.CreateQueryLoggingConfigInput) (*route53.CreateQueryLoggingConfigOutput, error)
CreateQueryLoggingConfigWithContext(aws.Context, *route53.CreateQueryLoggingConfigInput, ...request.Option) (*route53.CreateQueryLoggingConfigOutput, error)
CreateQueryLoggingConfigRequest(*route53.CreateQueryLoggingConfigInput) (*request.Request, *route53.CreateQueryLoggingConfigOutput)
CreateReusableDelegationSet(*route53.CreateReusableDelegationSetInput) (*route53.CreateReusableDelegationSetOutput, error)
CreateReusableDelegationSetWithContext(aws.Context, *route53.CreateReusableDelegationSetInput, ...request.Option) (*route53.CreateReusableDelegationSetOutput, error)
CreateReusableDelegationSetRequest(*route53.CreateReusableDelegationSetInput) (*request.Request, *route53.CreateReusableDelegationSetOutput)
CreateTrafficPolicy(*route53.CreateTrafficPolicyInput) (*route53.CreateTrafficPolicyOutput, error)
CreateTrafficPolicyWithContext(aws.Context, *route53.CreateTrafficPolicyInput, ...request.Option) (*route53.CreateTrafficPolicyOutput, error)
CreateTrafficPolicyRequest(*route53.CreateTrafficPolicyInput) (*request.Request, *route53.CreateTrafficPolicyOutput)
CreateTrafficPolicyInstance(*route53.CreateTrafficPolicyInstanceInput) (*route53.CreateTrafficPolicyInstanceOutput, error)
CreateTrafficPolicyInstanceWithContext(aws.Context, *route53.CreateTrafficPolicyInstanceInput, ...request.Option) (*route53.CreateTrafficPolicyInstanceOutput, error)
CreateTrafficPolicyInstanceRequest(*route53.CreateTrafficPolicyInstanceInput) (*request.Request, *route53.CreateTrafficPolicyInstanceOutput)
CreateTrafficPolicyVersion(*route53.CreateTrafficPolicyVersionInput) (*route53.CreateTrafficPolicyVersionOutput, error)
CreateTrafficPolicyVersionWithContext(aws.Context, *route53.CreateTrafficPolicyVersionInput, ...request.Option) (*route53.CreateTrafficPolicyVersionOutput, error)
CreateTrafficPolicyVersionRequest(*route53.CreateTrafficPolicyVersionInput) (*request.Request, *route53.CreateTrafficPolicyVersionOutput)
CreateVPCAssociationAuthorization(*route53.CreateVPCAssociationAuthorizationInput) (*route53.CreateVPCAssociationAuthorizationOutput, error)
CreateVPCAssociationAuthorizationWithContext(aws.Context, *route53.CreateVPCAssociationAuthorizationInput, ...request.Option) (*route53.CreateVPCAssociationAuthorizationOutput, error)
CreateVPCAssociationAuthorizationRequest(*route53.CreateVPCAssociationAuthorizationInput) (*request.Request, *route53.CreateVPCAssociationAuthorizationOutput)
DeleteHealthCheck(*route53.DeleteHealthCheckInput) (*route53.DeleteHealthCheckOutput, error)
DeleteHealthCheckWithContext(aws.Context, *route53.DeleteHealthCheckInput, ...request.Option) (*route53.DeleteHealthCheckOutput, error)
DeleteHealthCheckRequest(*route53.DeleteHealthCheckInput) (*request.Request, *route53.DeleteHealthCheckOutput)
DeleteHostedZone(*route53.DeleteHostedZoneInput) (*route53.DeleteHostedZoneOutput, error)
DeleteHostedZoneWithContext(aws.Context, *route53.DeleteHostedZoneInput, ...request.Option) (*route53.DeleteHostedZoneOutput, error)
DeleteHostedZoneRequest(*route53.DeleteHostedZoneInput) (*request.Request, *route53.DeleteHostedZoneOutput)
DeleteQueryLoggingConfig(*route53.DeleteQueryLoggingConfigInput) (*route53.DeleteQueryLoggingConfigOutput, error)
DeleteQueryLoggingConfigWithContext(aws.Context, *route53.DeleteQueryLoggingConfigInput, ...request.Option) (*route53.DeleteQueryLoggingConfigOutput, error)
DeleteQueryLoggingConfigRequest(*route53.DeleteQueryLoggingConfigInput) (*request.Request, *route53.DeleteQueryLoggingConfigOutput)
DeleteReusableDelegationSet(*route53.DeleteReusableDelegationSetInput) (*route53.DeleteReusableDelegationSetOutput, error)
DeleteReusableDelegationSetWithContext(aws.Context, *route53.DeleteReusableDelegationSetInput, ...request.Option) (*route53.DeleteReusableDelegationSetOutput, error)
DeleteReusableDelegationSetRequest(*route53.DeleteReusableDelegationSetInput) (*request.Request, *route53.DeleteReusableDelegationSetOutput)
DeleteTrafficPolicy(*route53.DeleteTrafficPolicyInput) (*route53.DeleteTrafficPolicyOutput, error)
DeleteTrafficPolicyWithContext(aws.Context, *route53.DeleteTrafficPolicyInput, ...request.Option) (*route53.DeleteTrafficPolicyOutput, error)
DeleteTrafficPolicyRequest(*route53.DeleteTrafficPolicyInput) (*request.Request, *route53.DeleteTrafficPolicyOutput)
DeleteTrafficPolicyInstance(*route53.DeleteTrafficPolicyInstanceInput) (*route53.DeleteTrafficPolicyInstanceOutput, error)
DeleteTrafficPolicyInstanceWithContext(aws.Context, *route53.DeleteTrafficPolicyInstanceInput, ...request.Option) (*route53.DeleteTrafficPolicyInstanceOutput, error)
DeleteTrafficPolicyInstanceRequest(*route53.DeleteTrafficPolicyInstanceInput) (*request.Request, *route53.DeleteTrafficPolicyInstanceOutput)
DeleteVPCAssociationAuthorization(*route53.DeleteVPCAssociationAuthorizationInput) (*route53.DeleteVPCAssociationAuthorizationOutput, error)
DeleteVPCAssociationAuthorizationWithContext(aws.Context, *route53.DeleteVPCAssociationAuthorizationInput, ...request.Option) (*route53.DeleteVPCAssociationAuthorizationOutput, error)
DeleteVPCAssociationAuthorizationRequest(*route53.DeleteVPCAssociationAuthorizationInput) (*request.Request, *route53.DeleteVPCAssociationAuthorizationOutput)
DisassociateVPCFromHostedZone(*route53.DisassociateVPCFromHostedZoneInput) (*route53.DisassociateVPCFromHostedZoneOutput, error)
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)
GetCheckerIpRanges(*route53.GetCheckerIpRangesInput) (*route53.GetCheckerIpRangesOutput, error)
GetCheckerIpRangesWithContext(aws.Context, *route53.GetCheckerIpRangesInput, ...request.Option) (*route53.GetCheckerIpRangesOutput, error)
GetCheckerIpRangesRequest(*route53.GetCheckerIpRangesInput) (*request.Request, *route53.GetCheckerIpRangesOutput)
GetGeoLocation(*route53.GetGeoLocationInput) (*route53.GetGeoLocationOutput, error)
GetGeoLocationWithContext(aws.Context, *route53.GetGeoLocationInput, ...request.Option) (*route53.GetGeoLocationOutput, error)
GetGeoLocationRequest(*route53.GetGeoLocationInput) (*request.Request, *route53.GetGeoLocationOutput)
GetHealthCheck(*route53.GetHealthCheckInput) (*route53.GetHealthCheckOutput, error)
GetHealthCheckWithContext(aws.Context, *route53.GetHealthCheckInput, ...request.Option) (*route53.GetHealthCheckOutput, error)
GetHealthCheckRequest(*route53.GetHealthCheckInput) (*request.Request, *route53.GetHealthCheckOutput)
GetHealthCheckCount(*route53.GetHealthCheckCountInput) (*route53.GetHealthCheckCountOutput, error)
GetHealthCheckCountWithContext(aws.Context, *route53.GetHealthCheckCountInput, ...request.Option) (*route53.GetHealthCheckCountOutput, error)
GetHealthCheckCountRequest(*route53.GetHealthCheckCountInput) (*request.Request, *route53.GetHealthCheckCountOutput)
GetHealthCheckLastFailureReason(*route53.GetHealthCheckLastFailureReasonInput) (*route53.GetHealthCheckLastFailureReasonOutput, error)
GetHealthCheckLastFailureReasonWithContext(aws.Context, *route53.GetHealthCheckLastFailureReasonInput, ...request.Option) (*route53.GetHealthCheckLastFailureReasonOutput, error)
GetHealthCheckLastFailureReasonRequest(*route53.GetHealthCheckLastFailureReasonInput) (*request.Request, *route53.GetHealthCheckLastFailureReasonOutput)
GetHealthCheckStatus(*route53.GetHealthCheckStatusInput) (*route53.GetHealthCheckStatusOutput, error)
GetHealthCheckStatusWithContext(aws.Context, *route53.GetHealthCheckStatusInput, ...request.Option) (*route53.GetHealthCheckStatusOutput, error)
GetHealthCheckStatusRequest(*route53.GetHealthCheckStatusInput) (*request.Request, *route53.GetHealthCheckStatusOutput)
GetHostedZone(*route53.GetHostedZoneInput) (*route53.GetHostedZoneOutput, error)
GetHostedZoneWithContext(aws.Context, *route53.GetHostedZoneInput, ...request.Option) (*route53.GetHostedZoneOutput, error)
GetHostedZoneRequest(*route53.GetHostedZoneInput) (*request.Request, *route53.GetHostedZoneOutput)
GetHostedZoneCount(*route53.GetHostedZoneCountInput) (*route53.GetHostedZoneCountOutput, error)
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)
GetReusableDelegationSet(*route53.GetReusableDelegationSetInput) (*route53.GetReusableDelegationSetOutput, error)
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)
GetTrafficPolicyInstance(*route53.GetTrafficPolicyInstanceInput) (*route53.GetTrafficPolicyInstanceOutput, error)
GetTrafficPolicyInstanceWithContext(aws.Context, *route53.GetTrafficPolicyInstanceInput, ...request.Option) (*route53.GetTrafficPolicyInstanceOutput, error)
GetTrafficPolicyInstanceRequest(*route53.GetTrafficPolicyInstanceInput) (*request.Request, *route53.GetTrafficPolicyInstanceOutput)
GetTrafficPolicyInstanceCount(*route53.GetTrafficPolicyInstanceCountInput) (*route53.GetTrafficPolicyInstanceCountOutput, error)
GetTrafficPolicyInstanceCountWithContext(aws.Context, *route53.GetTrafficPolicyInstanceCountInput, ...request.Option) (*route53.GetTrafficPolicyInstanceCountOutput, error)
GetTrafficPolicyInstanceCountRequest(*route53.GetTrafficPolicyInstanceCountInput) (*request.Request, *route53.GetTrafficPolicyInstanceCountOutput)
ListGeoLocations(*route53.ListGeoLocationsInput) (*route53.ListGeoLocationsOutput, error)
ListGeoLocationsWithContext(aws.Context, *route53.ListGeoLocationsInput, ...request.Option) (*route53.ListGeoLocationsOutput, error)
ListGeoLocationsRequest(*route53.ListGeoLocationsInput) (*request.Request, *route53.ListGeoLocationsOutput)
ListHealthChecks(*route53.ListHealthChecksInput) (*route53.ListHealthChecksOutput, error)
ListHealthChecksWithContext(aws.Context, *route53.ListHealthChecksInput, ...request.Option) (*route53.ListHealthChecksOutput, error)
ListHealthChecksRequest(*route53.ListHealthChecksInput) (*request.Request, *route53.ListHealthChecksOutput)
ListHealthChecksPages(*route53.ListHealthChecksInput, func(*route53.ListHealthChecksOutput, bool) bool) error
ListHealthChecksPagesWithContext(aws.Context, *route53.ListHealthChecksInput, func(*route53.ListHealthChecksOutput, bool) bool, ...request.Option) error
ListHostedZones(*route53.ListHostedZonesInput) (*route53.ListHostedZonesOutput, error)
ListHostedZonesWithContext(aws.Context, *route53.ListHostedZonesInput, ...request.Option) (*route53.ListHostedZonesOutput, error)
ListHostedZonesRequest(*route53.ListHostedZonesInput) (*request.Request, *route53.ListHostedZonesOutput)
ListHostedZonesPages(*route53.ListHostedZonesInput, func(*route53.ListHostedZonesOutput, bool) bool) error
ListHostedZonesPagesWithContext(aws.Context, *route53.ListHostedZonesInput, func(*route53.ListHostedZonesOutput, bool) bool, ...request.Option) error
ListHostedZonesByName(*route53.ListHostedZonesByNameInput) (*route53.ListHostedZonesByNameOutput, error)
ListHostedZonesByNameWithContext(aws.Context, *route53.ListHostedZonesByNameInput, ...request.Option) (*route53.ListHostedZonesByNameOutput, error)
ListHostedZonesByNameRequest(*route53.ListHostedZonesByNameInput) (*request.Request, *route53.ListHostedZonesByNameOutput)
ListQueryLoggingConfigs(*route53.ListQueryLoggingConfigsInput) (*route53.ListQueryLoggingConfigsOutput, error)
ListQueryLoggingConfigsWithContext(aws.Context, *route53.ListQueryLoggingConfigsInput, ...request.Option) (*route53.ListQueryLoggingConfigsOutput, error)
ListQueryLoggingConfigsRequest(*route53.ListQueryLoggingConfigsInput) (*request.Request, *route53.ListQueryLoggingConfigsOutput)
ListResourceRecordSets(*route53.ListResourceRecordSetsInput) (*route53.ListResourceRecordSetsOutput, error)
ListResourceRecordSetsWithContext(aws.Context, *route53.ListResourceRecordSetsInput, ...request.Option) (*route53.ListResourceRecordSetsOutput, error)
ListResourceRecordSetsRequest(*route53.ListResourceRecordSetsInput) (*request.Request, *route53.ListResourceRecordSetsOutput)
ListResourceRecordSetsPages(*route53.ListResourceRecordSetsInput, func(*route53.ListResourceRecordSetsOutput, bool) bool) error
ListResourceRecordSetsPagesWithContext(aws.Context, *route53.ListResourceRecordSetsInput, func(*route53.ListResourceRecordSetsOutput, bool) bool, ...request.Option) error
ListReusableDelegationSets(*route53.ListReusableDelegationSetsInput) (*route53.ListReusableDelegationSetsOutput, error)
ListReusableDelegationSetsWithContext(aws.Context, *route53.ListReusableDelegationSetsInput, ...request.Option) (*route53.ListReusableDelegationSetsOutput, error)
ListReusableDelegationSetsRequest(*route53.ListReusableDelegationSetsInput) (*request.Request, *route53.ListReusableDelegationSetsOutput)
ListTagsForResource(*route53.ListTagsForResourceInput) (*route53.ListTagsForResourceOutput, error)
ListTagsForResourceWithContext(aws.Context, *route53.ListTagsForResourceInput, ...request.Option) (*route53.ListTagsForResourceOutput, error)
ListTagsForResourceRequest(*route53.ListTagsForResourceInput) (*request.Request, *route53.ListTagsForResourceOutput)
ListTagsForResources(*route53.ListTagsForResourcesInput) (*route53.ListTagsForResourcesOutput, error)
ListTagsForResourcesWithContext(aws.Context, *route53.ListTagsForResourcesInput, ...request.Option) (*route53.ListTagsForResourcesOutput, error)
ListTagsForResourcesRequest(*route53.ListTagsForResourcesInput) (*request.Request, *route53.ListTagsForResourcesOutput)
ListTrafficPolicies(*route53.ListTrafficPoliciesInput) (*route53.ListTrafficPoliciesOutput, error)
ListTrafficPoliciesWithContext(aws.Context, *route53.ListTrafficPoliciesInput, ...request.Option) (*route53.ListTrafficPoliciesOutput, error)
ListTrafficPoliciesRequest(*route53.ListTrafficPoliciesInput) (*request.Request, *route53.ListTrafficPoliciesOutput)
ListTrafficPolicyInstances(*route53.ListTrafficPolicyInstancesInput) (*route53.ListTrafficPolicyInstancesOutput, error)
ListTrafficPolicyInstancesWithContext(aws.Context, *route53.ListTrafficPolicyInstancesInput, ...request.Option) (*route53.ListTrafficPolicyInstancesOutput, error)
ListTrafficPolicyInstancesRequest(*route53.ListTrafficPolicyInstancesInput) (*request.Request, *route53.ListTrafficPolicyInstancesOutput)
ListTrafficPolicyInstancesByHostedZone(*route53.ListTrafficPolicyInstancesByHostedZoneInput) (*route53.ListTrafficPolicyInstancesByHostedZoneOutput, error)
ListTrafficPolicyInstancesByHostedZoneWithContext(aws.Context, *route53.ListTrafficPolicyInstancesByHostedZoneInput, ...request.Option) (*route53.ListTrafficPolicyInstancesByHostedZoneOutput, error)
ListTrafficPolicyInstancesByHostedZoneRequest(*route53.ListTrafficPolicyInstancesByHostedZoneInput) (*request.Request, *route53.ListTrafficPolicyInstancesByHostedZoneOutput)
ListTrafficPolicyInstancesByPolicy(*route53.ListTrafficPolicyInstancesByPolicyInput) (*route53.ListTrafficPolicyInstancesByPolicyOutput, error)
ListTrafficPolicyInstancesByPolicyWithContext(aws.Context, *route53.ListTrafficPolicyInstancesByPolicyInput, ...request.Option) (*route53.ListTrafficPolicyInstancesByPolicyOutput, error)
ListTrafficPolicyInstancesByPolicyRequest(*route53.ListTrafficPolicyInstancesByPolicyInput) (*request.Request, *route53.ListTrafficPolicyInstancesByPolicyOutput)
ListTrafficPolicyVersions(*route53.ListTrafficPolicyVersionsInput) (*route53.ListTrafficPolicyVersionsOutput, error)
ListTrafficPolicyVersionsWithContext(aws.Context, *route53.ListTrafficPolicyVersionsInput, ...request.Option) (*route53.ListTrafficPolicyVersionsOutput, error)
ListTrafficPolicyVersionsRequest(*route53.ListTrafficPolicyVersionsInput) (*request.Request, *route53.ListTrafficPolicyVersionsOutput)
ListVPCAssociationAuthorizations(*route53.ListVPCAssociationAuthorizationsInput) (*route53.ListVPCAssociationAuthorizationsOutput, error)
ListVPCAssociationAuthorizationsWithContext(aws.Context, *route53.ListVPCAssociationAuthorizationsInput, ...request.Option) (*route53.ListVPCAssociationAuthorizationsOutput, error)
ListVPCAssociationAuthorizationsRequest(*route53.ListVPCAssociationAuthorizationsInput) (*request.Request, *route53.ListVPCAssociationAuthorizationsOutput)
TestDNSAnswer(*route53.TestDNSAnswerInput) (*route53.TestDNSAnswerOutput, error)
TestDNSAnswerWithContext(aws.Context, *route53.TestDNSAnswerInput, ...request.Option) (*route53.TestDNSAnswerOutput, error)
TestDNSAnswerRequest(*route53.TestDNSAnswerInput) (*request.Request, *route53.TestDNSAnswerOutput)
UpdateHealthCheck(*route53.UpdateHealthCheckInput) (*route53.UpdateHealthCheckOutput, error)
UpdateHealthCheckWithContext(aws.Context, *route53.UpdateHealthCheckInput, ...request.Option) (*route53.UpdateHealthCheckOutput, error)
UpdateHealthCheckRequest(*route53.UpdateHealthCheckInput) (*request.Request, *route53.UpdateHealthCheckOutput)
UpdateHostedZoneComment(*route53.UpdateHostedZoneCommentInput) (*route53.UpdateHostedZoneCommentOutput, error)
UpdateHostedZoneCommentWithContext(aws.Context, *route53.UpdateHostedZoneCommentInput, ...request.Option) (*route53.UpdateHostedZoneCommentOutput, error)
UpdateHostedZoneCommentRequest(*route53.UpdateHostedZoneCommentInput) (*request.Request, *route53.UpdateHostedZoneCommentOutput)
UpdateTrafficPolicyComment(*route53.UpdateTrafficPolicyCommentInput) (*route53.UpdateTrafficPolicyCommentOutput, error)
UpdateTrafficPolicyCommentWithContext(aws.Context, *route53.UpdateTrafficPolicyCommentInput, ...request.Option) (*route53.UpdateTrafficPolicyCommentOutput, error)
UpdateTrafficPolicyCommentRequest(*route53.UpdateTrafficPolicyCommentInput) (*request.Request, *route53.UpdateTrafficPolicyCommentOutput)
UpdateTrafficPolicyInstance(*route53.UpdateTrafficPolicyInstanceInput) (*route53.UpdateTrafficPolicyInstanceOutput, error)
UpdateTrafficPolicyInstanceWithContext(aws.Context, *route53.UpdateTrafficPolicyInstanceInput, ...request.Option) (*route53.UpdateTrafficPolicyInstanceOutput, error)
UpdateTrafficPolicyInstanceRequest(*route53.UpdateTrafficPolicyInstanceInput) (*request.Request, *route53.UpdateTrafficPolicyInstanceOutput)
WaitUntilResourceRecordSetsChanged(*route53.GetChangeInput) error
WaitUntilResourceRecordSetsChangedWithContext(aws.Context, *route53.GetChangeInput, ...request.WaiterOption) error
}
var _ Route53API = (*route53.Route53)(nil)

View file

@ -0,0 +1,93 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package route53
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/restxml"
)
// Route53 provides the API operation methods for making requests to
// Amazon Route 53. See this package's package overview docs
// for details on the service.
//
// Route53 methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type Route53 struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "route53" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the Route53 client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a Route53 client from just a session.
// svc := route53.New(mySession)
//
// // Create a Route53 client with additional configuration
// svc := route53.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Route53 {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Route53 {
svc := &Route53{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2013-04-01",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a Route53 operation and runs any
// custom request initialization.
func (c *Route53) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

View file

@ -0,0 +1,77 @@
package route53
import (
"bytes"
"encoding/xml"
"io/ioutil"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol/restxml"
)
type baseXMLErrorResponse struct {
XMLName xml.Name
}
type standardXMLErrorResponse struct {
XMLName xml.Name `xml:"ErrorResponse"`
Code string `xml:"Error>Code"`
Message string `xml:"Error>Message"`
RequestID string `xml:"RequestId"`
}
type invalidChangeBatchXMLErrorResponse struct {
XMLName xml.Name `xml:"InvalidChangeBatch"`
Messages []string `xml:"Messages>Message"`
}
func unmarshalChangeResourceRecordSetsError(r *request.Request) {
defer r.HTTPResponse.Body.Close()
responseBody, err := ioutil.ReadAll(r.HTTPResponse.Body)
if err != nil {
r.Error = awserr.New("SerializationError", "failed to read Route53 XML error response", err)
return
}
baseError := &baseXMLErrorResponse{}
if err := xml.Unmarshal(responseBody, baseError); err != nil {
r.Error = awserr.New("SerializationError", "failed to decode Route53 XML error response", err)
return
}
switch baseError.XMLName.Local {
case "InvalidChangeBatch":
unmarshalInvalidChangeBatchError(r, responseBody)
default:
r.HTTPResponse.Body = ioutil.NopCloser(bytes.NewReader(responseBody))
restxml.UnmarshalError(r)
}
}
func unmarshalInvalidChangeBatchError(r *request.Request, requestBody []byte) {
resp := &invalidChangeBatchXMLErrorResponse{}
err := xml.Unmarshal(requestBody, resp)
if err != nil {
r.Error = awserr.New("SerializationError", "failed to decode query XML error response", err)
return
}
const errorCode = "InvalidChangeBatch"
errors := []error{}
for _, msg := range resp.Messages {
errors = append(errors, awserr.New(errorCode, msg, nil))
}
r.Error = awserr.NewRequestFailure(
awserr.NewBatchError(errorCode, "ChangeBatch errors occurred", errors),
r.HTTPResponse.StatusCode,
r.RequestID,
)
}

View file

@ -0,0 +1,43 @@
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

@ -0,0 +1,130 @@
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

@ -0,0 +1,56 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package route53
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
)
// WaitUntilResourceRecordSetsChanged uses the Route 53 API operation
// GetChange to wait for a condition to be met before returning.
// If the condition is not met within the max attempt window, an error will
// be returned.
func (c *Route53) WaitUntilResourceRecordSetsChanged(input *GetChangeInput) error {
return c.WaitUntilResourceRecordSetsChangedWithContext(aws.BackgroundContext(), input)
}
// WaitUntilResourceRecordSetsChangedWithContext is an extended version of WaitUntilResourceRecordSetsChanged.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *Route53) WaitUntilResourceRecordSetsChangedWithContext(ctx aws.Context, input *GetChangeInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilResourceRecordSetsChanged",
MaxAttempts: 60,
Delay: request.ConstantWaiterDelay(30 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.PathWaiterMatch, Argument: "ChangeInfo.Status",
Expected: "INSYNC",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
var inCpy *GetChangeInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.GetChangeRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}

2358
vendor/github.com/aws/aws-sdk-go/service/sts/api.go generated vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
package sts
import "github.com/aws/aws-sdk-go/aws/request"
func init() {
initRequest = func(r *request.Request) {
switch r.Operation.Name {
case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity:
r.Handlers.Sign.Clear() // these operations are unsigned
}
}
}

View file

@ -0,0 +1,45 @@
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)
}
}

72
vendor/github.com/aws/aws-sdk-go/service/sts/doc.go generated vendored Normal file
View file

@ -0,0 +1,72 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package sts provides the client and types for making API
// requests to AWS Security Token Service.
//
// The AWS Security Token Service (STS) is a web service that enables you to
// request temporary, limited-privilege credentials for AWS Identity and Access
// Management (IAM) users or for users that you authenticate (federated users).
// This guide provides descriptions of the STS API. For more detailed information
// about using this service, go to Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html).
//
// As an alternative to using the API, you can use one of the AWS SDKs, which
// consist of libraries and sample code for various programming languages and
// platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient
// way to create programmatic access to STS. For example, the SDKs take care
// of cryptographically signing requests, managing errors, and retrying requests
// automatically. For information about the AWS SDKs, including how to download
// and install them, see the Tools for Amazon Web Services page (http://aws.amazon.com/tools/).
//
// For information about setting up signatures and authorization through the
// API, go to Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html)
// in the AWS General Reference. For general information about the Query API,
// go to Making Query Requests (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html)
// in Using IAM. For information about using security tokens with other AWS
// products, go to AWS Services That Work with IAM (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)
// in the IAM User Guide.
//
// If you're new to AWS and need additional technical information about a specific
// AWS product, you can find the product's technical documentation at http://aws.amazon.com/documentation/
// (http://aws.amazon.com/documentation/).
//
// Endpoints
//
// The AWS Security Token Service (STS) has a default endpoint of https://sts.amazonaws.com
// that maps to the US East (N. Virginia) region. Additional regions are available
// and are activated by default. For more information, see Activating and Deactivating
// AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
// in the IAM User Guide.
//
// For information about STS endpoints, see Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#sts_region)
// in the AWS General Reference.
//
// Recording API requests
//
// STS supports AWS CloudTrail, which is a service that records AWS calls for
// your AWS account and delivers log files to an Amazon S3 bucket. By using
// information collected by CloudTrail, you can determine what requests were
// successfully made to STS, who made the request, when it was made, and so
// on. To learn more about CloudTrail, including how to turn it on and find
// your log files, see the AWS CloudTrail User Guide (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html).
//
// See https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15 for more information on this service.
//
// See sts package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/sts/
//
// Using the Client
//
// To contact AWS Security Token Service 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.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the AWS Security Token Service client STS for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/sts/#New
package sts

73
vendor/github.com/aws/aws-sdk-go/service/sts/errors.go generated vendored Normal file
View file

@ -0,0 +1,73 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package sts
const (
// ErrCodeExpiredTokenException for service response error code
// "ExpiredTokenException".
//
// The web identity token that was passed is expired or is not valid. Get a
// new identity token from the identity provider and then retry the request.
ErrCodeExpiredTokenException = "ExpiredTokenException"
// ErrCodeIDPCommunicationErrorException for service response error code
// "IDPCommunicationError".
//
// The request could not be fulfilled because the non-AWS identity provider
// (IDP) that was asked to verify the incoming identity token could not be reached.
// This is often a transient error caused by network conditions. Retry the request
// a limited number of times so that you don't exceed the request rate. If the
// error persists, the non-AWS identity provider might be down or not responding.
ErrCodeIDPCommunicationErrorException = "IDPCommunicationError"
// ErrCodeIDPRejectedClaimException for service response error code
// "IDPRejectedClaim".
//
// The identity provider (IdP) reported that authentication failed. This might
// be because the claim is invalid.
//
// If this error is returned for the AssumeRoleWithWebIdentity operation, it
// can also mean that the claim has expired or has been explicitly revoked.
ErrCodeIDPRejectedClaimException = "IDPRejectedClaim"
// ErrCodeInvalidAuthorizationMessageException for service response error code
// "InvalidAuthorizationMessageException".
//
// The error returned if the message passed to DecodeAuthorizationMessage was
// invalid. This can happen if the token contains invalid characters, such as
// linebreaks.
ErrCodeInvalidAuthorizationMessageException = "InvalidAuthorizationMessageException"
// ErrCodeInvalidIdentityTokenException for service response error code
// "InvalidIdentityToken".
//
// The web identity token that was passed could not be validated by AWS. Get
// a new identity token from the identity provider and then retry the request.
ErrCodeInvalidIdentityTokenException = "InvalidIdentityToken"
// ErrCodeMalformedPolicyDocumentException for service response error code
// "MalformedPolicyDocument".
//
// The request was rejected because the policy document was malformed. The error
// message describes the specific error.
ErrCodeMalformedPolicyDocumentException = "MalformedPolicyDocument"
// ErrCodePackedPolicyTooLargeException for service response error code
// "PackedPolicyTooLarge".
//
// The request was rejected because the policy document was too large. The error
// message describes how big the policy document is, in packed form, as a percentage
// of what the API allows.
ErrCodePackedPolicyTooLargeException = "PackedPolicyTooLarge"
// ErrCodeRegionDisabledException for service response error code
// "RegionDisabledException".
//
// STS is not activated in the requested region for the account that is being
// asked to generate credentials. The account administrator must use the IAM
// console to activate STS in that region. For more information, see Activating
// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
// in the IAM User Guide.
ErrCodeRegionDisabledException = "RegionDisabledException"
)

View file

@ -0,0 +1,282 @@
// 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)
}

View file

@ -0,0 +1,93 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package sts
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/query"
)
// STS provides the API operation methods for making requests to
// AWS Security Token Service. See this package's package overview docs
// for details on the service.
//
// STS methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type STS struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "sts" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the STS client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a STS client from just a session.
// svc := sts.New(mySession)
//
// // Create a STS client with additional configuration
// svc := sts.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *STS {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *STS {
svc := &STS{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2011-06-15",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a STS operation and runs any
// custom request initialization.
func (c *STS) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}