本文整理汇总了Golang中github.com/datacratic/aws-sdk-go/aws.String函数的典型用法代码示例。如果您正苦于以下问题:Golang String函数的具体用法?Golang String怎么用?Golang String使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了String函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleCloudWatchLogs_PutLogEvents
func ExampleCloudWatchLogs_PutLogEvents() {
svc := cloudwatchlogs.New(nil)
params := &cloudwatchlogs.PutLogEventsInput{
LogEvents: []*cloudwatchlogs.InputLogEvent{ // Required
&cloudwatchlogs.InputLogEvent{ // Required
Message: aws.String("EventMessage"), // Required
Timestamp: aws.Long(1), // Required
},
// More values...
},
LogGroupName: aws.String("LogGroupName"), // Required
LogStreamName: aws.String("LogStreamName"), // Required
SequenceToken: aws.String("SequenceToken"),
}
resp, err := svc.PutLogEvents(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例2: ExampleSSM_UpdateAssociationStatus
func ExampleSSM_UpdateAssociationStatus() {
svc := ssm.New(nil)
params := &ssm.UpdateAssociationStatusInput{
AssociationStatus: &ssm.AssociationStatus{ // Required
Date: aws.Time(time.Now()), // Required
Message: aws.String("StatusMessage"), // Required
Name: aws.String("AssociationStatusName"), // Required
AdditionalInfo: aws.String("StatusAdditionalInfo"),
},
InstanceID: aws.String("InstanceId"), // Required
Name: aws.String("DocumentName"), // Required
}
resp, err := svc.UpdateAssociationStatus(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例3: ExampleLambda_AddEventSource
func ExampleLambda_AddEventSource() {
svc := lambda.New(nil)
params := &lambda.AddEventSourceInput{
EventSource: aws.String("String"), // Required
FunctionName: aws.String("FunctionName"), // Required
Role: aws.String("RoleArn"), // Required
BatchSize: aws.Long(1),
Parameters: &map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
}
resp, err := svc.AddEventSource(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例4: ExampleS3_DeleteObjects
func ExampleS3_DeleteObjects() {
svc := s3.New(nil)
params := &s3.DeleteObjectsInput{
Bucket: aws.String("BucketName"), // Required
Delete: &s3.Delete{ // Required
Objects: []*s3.ObjectIdentifier{ // Required
&s3.ObjectIdentifier{ // Required
Key: aws.String("ObjectKey"), // Required
VersionID: aws.String("ObjectVersionId"),
},
// More values...
},
Quiet: aws.Boolean(true),
},
MFA: aws.String("MFA"),
RequestPayer: aws.String("RequestPayer"),
}
resp, err := svc.DeleteObjects(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例5: ExampleS3_HeadObject
func ExampleS3_HeadObject() {
svc := s3.New(nil)
params := &s3.HeadObjectInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
IfMatch: aws.String("IfMatch"),
IfModifiedSince: aws.Time(time.Now()),
IfNoneMatch: aws.String("IfNoneMatch"),
IfUnmodifiedSince: aws.Time(time.Now()),
Range: aws.String("Range"),
RequestPayer: aws.String("RequestPayer"),
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
VersionID: aws.String("ObjectVersionId"),
}
resp, err := svc.HeadObject(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例6: TestCreateDistribution
func TestCreateDistribution(t *testing.T) {
client := cloudfront.New(nil)
_, serr := client.CreateDistribution(&cloudfront.CreateDistributionInput{
DistributionConfig: &cloudfront.DistributionConfig{
CallerReference: aws.String("ID1"),
Enabled: aws.Boolean(true),
Comment: aws.String("A comment"),
Origins: &cloudfront.Origins{Quantity: aws.Long(0)},
DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{
ForwardedValues: &cloudfront.ForwardedValues{
Cookies: &cloudfront.CookiePreference{Forward: aws.String("cookie")},
QueryString: aws.Boolean(true),
},
TargetOriginID: aws.String("origin"),
TrustedSigners: &cloudfront.TrustedSigners{
Enabled: aws.Boolean(true),
Quantity: aws.Long(0),
},
ViewerProtocolPolicy: aws.String("policy"),
MinTTL: aws.Long(0),
},
},
})
err := aws.Error(serr)
assert.NotNil(t, err)
assert.Equal(t, "MalformedXML", err.Code)
assertMatches(t, "validation errors detected", err.Message)
}
示例7: ExampleS3_PutBucketTagging
func ExampleS3_PutBucketTagging() {
svc := s3.New(nil)
params := &s3.PutBucketTaggingInput{
Bucket: aws.String("BucketName"), // Required
Tagging: &s3.Tagging{ // Required
TagSet: []*s3.Tag{ // Required
&s3.Tag{ // Required
Key: aws.String("ObjectKey"), // Required
Value: aws.String("Value"), // Required
},
// More values...
},
},
}
resp, err := svc.PutBucketTagging(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例8: 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 awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例9: ExampleRoute53_ChangeTagsForResource
func ExampleRoute53_ChangeTagsForResource() {
svc := route53.New(nil)
params := &route53.ChangeTagsForResourceInput{
ResourceID: aws.String("TagResourceId"), // Required
ResourceType: aws.String("TagResourceType"), // Required
AddTags: []*route53.Tag{
&route53.Tag{ // Required
Key: aws.String("TagKey"),
Value: aws.String("TagValue"),
},
// More values...
},
RemoveTagKeys: []*string{
aws.String("TagKey"), // Required
// More values...
},
}
resp, err := svc.ChangeTagsForResource(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例10: ExampleELB_RemoveTags
func ExampleELB_RemoveTags() {
svc := elb.New(nil)
params := &elb.RemoveTagsInput{
LoadBalancerNames: []*string{ // Required
aws.String("AccessPointName"), // Required
// More values...
},
Tags: []*elb.TagKeyOnly{ // Required
&elb.TagKeyOnly{ // Required
Key: aws.String("TagKey"),
},
// More values...
},
}
resp, err := svc.RemoveTags(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例11: ExampleELB_ConfigureHealthCheck
func ExampleELB_ConfigureHealthCheck() {
svc := elb.New(nil)
params := &elb.ConfigureHealthCheckInput{
HealthCheck: &elb.HealthCheck{ // Required
HealthyThreshold: aws.Long(1), // Required
Interval: aws.Long(1), // Required
Target: aws.String("HealthCheckTarget"), // Required
Timeout: aws.Long(1), // Required
UnhealthyThreshold: aws.Long(1), // Required
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.ConfigureHealthCheck(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例12: ExampleELB_RegisterInstancesWithLoadBalancer
func ExampleELB_RegisterInstancesWithLoadBalancer() {
svc := elb.New(nil)
params := &elb.RegisterInstancesWithLoadBalancerInput{
Instances: []*elb.Instance{ // Required
&elb.Instance{ // Required
InstanceID: aws.String("InstanceId"),
},
// More values...
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.RegisterInstancesWithLoadBalancer(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例13: ExampleELB_CreateLoadBalancerPolicy
func ExampleELB_CreateLoadBalancerPolicy() {
svc := elb.New(nil)
params := &elb.CreateLoadBalancerPolicyInput{
LoadBalancerName: aws.String("AccessPointName"), // Required
PolicyName: aws.String("PolicyName"), // Required
PolicyTypeName: aws.String("PolicyTypeName"), // Required
PolicyAttributes: []*elb.PolicyAttribute{
&elb.PolicyAttribute{ // Required
AttributeName: aws.String("AttributeName"),
AttributeValue: aws.String("AttributeValue"),
},
// More values...
},
}
resp, err := svc.CreateLoadBalancerPolicy(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例14: ExampleELB_CreateLoadBalancerListeners
func ExampleELB_CreateLoadBalancerListeners() {
svc := elb.New(nil)
params := &elb.CreateLoadBalancerListenersInput{
Listeners: []*elb.Listener{ // Required
&elb.Listener{ // Required
InstancePort: aws.Long(1), // Required
LoadBalancerPort: aws.Long(1), // Required
Protocol: aws.String("Protocol"), // Required
InstanceProtocol: aws.String("Protocol"),
SSLCertificateID: aws.String("SSLCertificateId"),
},
// More values...
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.CreateLoadBalancerListeners(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例15: ExampleRDS_DescribeDBLogFiles
func ExampleRDS_DescribeDBLogFiles() {
svc := rds.New(nil)
params := &rds.DescribeDBLogFilesInput{
DBInstanceIdentifier: aws.String("String"), // Required
FileLastWritten: aws.Long(1),
FileSize: aws.Long(1),
FilenameContains: aws.String("String"),
Filters: []*rds.Filter{
&rds.Filter{ // Required
Name: aws.String("String"), // Required
Values: []*string{ // Required
aws.String("String"), // Required
// More values...
},
},
// More values...
},
Marker: aws.String("String"),
MaxRecords: aws.Long(1),
}
resp, err := svc.DescribeDBLogFiles(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}