本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/route53.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleRoute53_ListGeoLocations
func ExampleRoute53_ListGeoLocations() {
svc := route53.New(nil)
params := &route53.ListGeoLocationsInput{
MaxItems: aws.String("PageMaxItems"),
StartContinentCode: aws.String("GeoLocationContinentCode"),
StartCountryCode: aws.String("GeoLocationCountryCode"),
StartSubdivisionCode: aws.String("GeoLocationSubdivisionCode"),
}
resp, err := svc.ListGeoLocations(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:29,代码来源:examples_test.go
示例2: ExampleRoute53_ListReusableDelegationSets
func ExampleRoute53_ListReusableDelegationSets() {
svc := route53.New(nil)
params := &route53.ListReusableDelegationSetsInput{
Marker: aws.String("PageMarker"),
MaxItems: aws.String("PageMaxItems"),
}
resp, err := svc.ListReusableDelegationSets(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:yourchanges,项目名称:empire,代码行数:27,代码来源:examples_test.go
示例3: ExampleRoute53_UpdateHealthCheck
func ExampleRoute53_UpdateHealthCheck() {
svc := route53.New(nil)
params := &route53.UpdateHealthCheckInput{
HealthCheckID: aws.String("HealthCheckId"), // Required
FailureThreshold: aws.Long(1),
FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"),
HealthCheckVersion: aws.Long(1),
IPAddress: aws.String("IPAddress"),
Port: aws.Long(1),
ResourcePath: aws.String("ResourcePath"),
SearchString: aws.String("SearchString"),
}
resp, err := svc.UpdateHealthCheck(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:yourchanges,项目名称:empire,代码行数:33,代码来源:examples_test.go
示例4: ExampleRoute53_UpdateHealthCheck
func ExampleRoute53_UpdateHealthCheck() {
svc := route53.New(session.New())
params := &route53.UpdateHealthCheckInput{
HealthCheckId: aws.String("HealthCheckId"), // Required
ChildHealthChecks: []*string{
aws.String("HealthCheckId"), // Required
// More values...
},
FailureThreshold: aws.Int64(1),
FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"),
HealthCheckVersion: aws.Int64(1),
HealthThreshold: aws.Int64(1),
IPAddress: aws.String("IPAddress"),
Inverted: aws.Bool(true),
Port: aws.Int64(1),
ResourcePath: aws.String("ResourcePath"),
SearchString: aws.String("SearchString"),
}
resp, err := svc.UpdateHealthCheck(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:frewsxcv,项目名称:empire,代码行数:31,代码来源:examples_test.go
示例5: ExampleRoute53_GetHealthCheckLastFailureReason
func ExampleRoute53_GetHealthCheckLastFailureReason() {
svc := route53.New(nil)
params := &route53.GetHealthCheckLastFailureReasonInput{
HealthCheckID: aws.String("HealthCheckId"), // Required
}
resp, err := svc.GetHealthCheckLastFailureReason(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:yourchanges,项目名称:empire,代码行数:26,代码来源:examples_test.go
示例6: CreateRecord
// CreateRecord for hosted zone id
func CreateRecord(zone string, record string, dest string) error {
svc := route53.New(session.New(), aws.NewConfig())
_, err := svc.ChangeResourceRecordSets(&route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("CREATE"),
ResourceRecordSet: &route53.ResourceRecordSet{
Name: aws.String(record),
Type: aws.String("A"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String(dest),
},
},
TTL: aws.Int64(60),
},
},
},
Comment: aws.String("ResourceDescription"),
},
HostedZoneId: aws.String(zone),
})
return err
}
开发者ID:sthulb,项目名称:route53-autoreg,代码行数:27,代码来源:aws.go
示例7: ExampleRoute53_ListChangeBatchesByRRSet
func ExampleRoute53_ListChangeBatchesByRRSet() {
svc := route53.New(session.New())
params := &route53.ListChangeBatchesByRRSetInput{
EndDate: aws.String("Date"), // Required
HostedZoneId: aws.String("ResourceId"), // Required
Name: aws.String("DNSName"), // Required
StartDate: aws.String("Date"), // Required
Type: aws.String("RRType"), // Required
Marker: aws.String("PageMarker"),
MaxItems: aws.String("PageMaxItems"),
SetIdentifier: aws.String("ResourceRecordSetIdentifier"),
}
resp, err := svc.ListChangeBatchesByRRSet(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:25,代码来源:examples_test.go
示例8: ExampleRoute53_CreateReusableDelegationSet
func ExampleRoute53_CreateReusableDelegationSet() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.CreateReusableDelegationSetInput{
CallerReference: aws.String("Nonce"), // Required
HostedZoneId: aws.String("ResourceId"),
}
resp, err := svc.CreateReusableDelegationSet(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:25,代码来源:examples_test.go
示例9: ExampleRoute53_CreateTrafficPolicyInstance
func ExampleRoute53_CreateTrafficPolicyInstance() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.CreateTrafficPolicyInstanceInput{
HostedZoneId: aws.String("ResourceId"), // Required
Name: aws.String("DNSName"), // Required
TTL: aws.Int64(1), // Required
TrafficPolicyId: aws.String("TrafficPolicyId"), // Required
TrafficPolicyVersion: aws.Int64(1), // Required
}
resp, err := svc.CreateTrafficPolicyInstance(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:28,代码来源:examples_test.go
示例10: ExampleRoute53_ListTrafficPolicyInstancesByPolicy
func ExampleRoute53_ListTrafficPolicyInstancesByPolicy() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.ListTrafficPolicyInstancesByPolicyInput{
TrafficPolicyId: aws.String("TrafficPolicyId"), // Required
TrafficPolicyVersion: aws.Int64(1), // Required
HostedZoneIdMarker: aws.String("ResourceId"),
MaxItems: aws.String("PageMaxItems"),
TrafficPolicyInstanceNameMarker: aws.String("DNSName"),
TrafficPolicyInstanceTypeMarker: aws.String("RRType"),
}
resp, err := svc.ListTrafficPolicyInstancesByPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:29,代码来源:examples_test.go
示例11: ExampleRoute53_UpdateHostedZoneComment
func ExampleRoute53_UpdateHostedZoneComment() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.UpdateHostedZoneCommentInput{
Id: aws.String("ResourceId"), // Required
Comment: aws.String("ResourceDescription"),
}
resp, err := svc.UpdateHostedZoneComment(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:25,代码来源:examples_test.go
示例12: ExampleRoute53_ListTagsForResources
func ExampleRoute53_ListTagsForResources() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.ListTagsForResourcesInput{
ResourceIds: []*string{ // Required
aws.String("TagResourceId"), // Required
// More values...
},
ResourceType: aws.String("TagResourceType"), // Required
}
resp, err := svc.ListTagsForResources(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:28,代码来源:examples_test.go
示例13: ExampleRoute53_ListResourceRecordSets
func ExampleRoute53_ListResourceRecordSets() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.ListResourceRecordSetsInput{
HostedZoneId: aws.String("ResourceId"), // Required
MaxItems: aws.String("PageMaxItems"),
StartRecordIdentifier: aws.String("ResourceRecordSetIdentifier"),
StartRecordName: aws.String("DNSName"),
StartRecordType: aws.String("RRType"),
}
resp, err := svc.ListResourceRecordSets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:28,代码来源:examples_test.go
示例14: ExampleRoute53_ListHostedZonesByName
func ExampleRoute53_ListHostedZonesByName() {
svc := route53.New(nil)
params := &route53.ListHostedZonesByNameInput{
DNSName: aws.String("DNSName"),
HostedZoneID: aws.String("ResourceId"),
MaxItems: aws.String("PageMaxItems"),
}
resp, err := svc.ListHostedZonesByName(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例15: ExampleRoute53_ListHostedZonesByName
func ExampleRoute53_ListHostedZonesByName() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.ListHostedZonesByNameInput{
DNSName: aws.String("DNSName"),
HostedZoneId: aws.String("ResourceId"),
MaxItems: aws.String("PageMaxItems"),
}
resp, err := svc.ListHostedZonesByName(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:26,代码来源:examples_test.go
示例16: ExampleRoute53_CreateTrafficPolicyVersion
func ExampleRoute53_CreateTrafficPolicyVersion() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.CreateTrafficPolicyVersionInput{
Document: aws.String("TrafficPolicyDocument"), // Required
Id: aws.String("TrafficPolicyId"), // Required
Comment: aws.String("TrafficPolicyComment"),
}
resp, err := svc.CreateTrafficPolicyVersion(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:26,代码来源:examples_test.go
示例17: DeleteRecord
// DeleteRecord for hosted zone id
func DeleteRecord(zone string, record string) error {
rec, err := DescribeRecord(zone, record)
if err != nil {
return err
}
svc := route53.New(session.New(), aws.NewConfig())
_, err = svc.ChangeResourceRecordSets(&route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{
Changes: []*route53.Change{
{
Action: aws.String("DELETE"),
ResourceRecordSet: &route53.ResourceRecordSet{
Name: aws.String(record),
Type: aws.String("A"),
ResourceRecords: []*route53.ResourceRecord{
{
Value: aws.String(*rec.Value),
},
},
TTL: aws.Int64(60),
},
},
},
Comment: aws.String("ResourceDescription"),
},
HostedZoneId: aws.String(zone),
})
return err
}
开发者ID:sthulb,项目名称:route53-autoreg,代码行数:32,代码来源:aws.go
示例18: ExampleRoute53_DisassociateVPCFromHostedZone
func ExampleRoute53_DisassociateVPCFromHostedZone() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.DisassociateVPCFromHostedZoneInput{
HostedZoneId: aws.String("ResourceId"), // Required
VPC: &route53.VPC{ // Required
VPCId: aws.String("VPCId"),
VPCRegion: aws.String("VPCRegion"),
},
Comment: aws.String("DisassociateVPCComment"),
}
resp, err := svc.DisassociateVPCFromHostedZone(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:29,代码来源:examples_test.go
示例19: New
func New(config Config) *Client {
credentials := credentials.NewStaticCredentials(config.AccessKey, config.SecretKey, "")
sdkConfig := &aws.Config{
Credentials: credentials,
Region: aws.String(config.RegionName),
}
endpointOverrides := config.EndpointOverrides
if endpointOverrides == nil {
endpointOverrides = &Endpoints{}
}
route53Client := route53.New(sdkConfig.Merge(&aws.Config{MaxRetries: aws.Int(7), Endpoint: aws.String(endpointOverrides.Route53)}))
ec2Client := ec2.New(sdkConfig.Merge(&aws.Config{MaxRetries: aws.Int(7), Endpoint: aws.String(endpointOverrides.EC2)}))
s3Client := s3.New(sdkConfig.Merge(&aws.Config{MaxRetries: aws.Int(7), Endpoint: aws.String(endpointOverrides.S3), S3ForcePathStyle: aws.Bool(true)}))
cloudformationClient := cloudformation.New(sdkConfig.Merge(&aws.Config{MaxRetries: aws.Int(7), Endpoint: aws.String(endpointOverrides.Cloudformation)}))
return &Client{
EC2: ec2Client,
S3: s3Client,
Route53: route53Client,
Cloudformation: cloudformationClient,
// HostedZoneID: config.HostedZoneID,
// HostedZoneName: config.HostedZoneName,
Bucket: config.Bucket,
}
}
开发者ID:rosenhouse,项目名称:bosh-classroom,代码行数:27,代码来源:aws_client.go
示例20: ExampleRoute53_ChangeResourceRecordSets
func ExampleRoute53_ChangeResourceRecordSets() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := route53.New(sess)
params := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{ // Required
Changes: []*route53.Change{ // Required
{ // Required
Action: aws.String("ChangeAction"), // Required
ResourceRecordSet: &route53.ResourceRecordSet{ // Required
Name: aws.String("DNSName"), // Required
Type: aws.String("RRType"), // Required
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("DNSName"), // Required
EvaluateTargetHealth: aws.Bool(true), // Required
HostedZoneId: aws.String("ResourceId"), // Required
},
Failover: aws.String("ResourceRecordSetFailover"),
GeoLocation: &route53.GeoLocation{
ContinentCode: aws.String("GeoLocationContinentCode"),
CountryCode: aws.String("GeoLocationCountryCode"),
SubdivisionCode: aws.String("GeoLocationSubdivisionCode"),
},
HealthCheckId: aws.String("HealthCheckId"),
Region: aws.String("ResourceRecordSetRegion"),
ResourceRecords: []*route53.ResourceRecord{
{ // Required
Value: aws.String("RData"), // Required
},
// More values...
},
SetIdentifier: aws.String("ResourceRecordSetIdentifier"),
TTL: aws.Int64(1),
TrafficPolicyInstanceId: aws.String("TrafficPolicyInstanceId"),
Weight: aws.Int64(1),
},
},
// More values...
},
Comment: aws.String("ResourceDescription"),
},
HostedZoneId: aws.String("ResourceId"), // Required
}
resp, err := svc.ChangeResourceRecordSets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:60,代码来源:examples_test.go
注:本文中的github.com/aws/aws-sdk-go/service/route53.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论