本文整理匯總了Golang中github.com/aws/aws-sdk-go/aws/awsutil.StringValue函數的典型用法代碼示例。如果您正苦於以下問題:Golang StringValue函數的具體用法?Golang StringValue怎麽用?Golang StringValue使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了StringValue函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: compareObjects
func compareObjects(t *testing.T, expected interface{}, actual interface{}) {
if !reflect.DeepEqual(expected, actual) {
t.Errorf("\nExpected %s:\n%s\nActual %s:\n%s\n",
reflect.ValueOf(expected).Kind(),
awsutil.StringValue(expected),
reflect.ValueOf(actual).Kind(),
awsutil.StringValue(actual))
}
}
示例2: getTags
func getTags(inst *ec2.Instance) []EC2InstanceTags {
var tags []EC2InstanceTags
for _, tag := range inst.Tags {
tag := EC2InstanceTags{
Name: strings.Replace(awsutil.StringValue(tag.Key), "\"", "", -1),
Value: strings.Replace(awsutil.StringValue(tag.Value), "\"", "", -1),
}
tags = append(tags, tag)
}
return tags
}
示例3: ExampleSNS_Unsubscribe
func ExampleSNS_Unsubscribe() {
svc := sns.New(nil)
params := &sns.UnsubscribeInput{
SubscriptionARN: aws.String("subscriptionARN"), // Required
}
resp, err := svc.Unsubscribe(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.StringValue(resp))
}
示例4: ExampleDirectoryService_CreateAlias
func ExampleDirectoryService_CreateAlias() {
svc := directoryservice.New(nil)
params := &directoryservice.CreateAliasInput{
Alias: aws.String("AliasName"), // Required
DirectoryID: aws.String("DirectoryId"), // Required
}
resp, err := svc.CreateAlias(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.StringValue(resp))
}
示例5: ExampleSQS_ChangeMessageVisibilityBatch
func ExampleSQS_ChangeMessageVisibilityBatch() {
svc := sqs.New(nil)
params := &sqs.ChangeMessageVisibilityBatchInput{
Entries: []*sqs.ChangeMessageVisibilityBatchRequestEntry{ // Required
{ // Required
ID: aws.String("String"), // Required
ReceiptHandle: aws.String("String"), // Required
VisibilityTimeout: aws.Long(1),
},
// More values...
},
QueueURL: aws.String("String"), // Required
}
resp, err := svc.ChangeMessageVisibilityBatch(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.StringValue(resp))
}
示例6: ExampleMachineLearning_UpdateMLModel
func ExampleMachineLearning_UpdateMLModel() {
svc := machinelearning.New(nil)
params := &machinelearning.UpdateMLModelInput{
MLModelID: aws.String("EntityId"), // Required
MLModelName: aws.String("EntityName"),
ScoreThreshold: aws.Double(1.0),
}
resp, err := svc.UpdateMLModel(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.StringValue(resp))
}
示例7: ExampleMachineLearning_CreateMLModel
func ExampleMachineLearning_CreateMLModel() {
svc := machinelearning.New(nil)
params := &machinelearning.CreateMLModelInput{
MLModelID: aws.String("EntityId"), // Required
MLModelType: aws.String("MLModelType"), // Required
TrainingDataSourceID: aws.String("EntityId"), // Required
MLModelName: aws.String("EntityName"),
Parameters: map[string]*string{
"Key": aws.String("StringType"), // Required
// More values...
},
Recipe: aws.String("Recipe"),
RecipeURI: aws.String("S3Url"),
}
resp, err := svc.CreateMLModel(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.StringValue(resp))
}
示例8: ExampleWorkSpaces_DescribeWorkspaceBundles
func ExampleWorkSpaces_DescribeWorkspaceBundles() {
svc := workspaces.New(nil)
params := &workspaces.DescribeWorkspaceBundlesInput{
BundleIDs: []*string{
aws.String("BundleId"), // Required
// More values...
},
NextToken: aws.String("PaginationToken"),
Owner: aws.String("BundleOwner"),
}
resp, err := svc.DescribeWorkspaceBundles(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.StringValue(resp))
}
示例9: 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))
}
示例10: ExampleRoute53_ListTagsForResources
func ExampleRoute53_ListTagsForResources() {
svc := route53.New(nil)
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 {
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))
}
示例11: 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))
}
示例12: ExampleRoute53_ListResourceRecordSets
func ExampleRoute53_ListResourceRecordSets() {
svc := route53.New(nil)
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 {
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))
}
示例13: 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))
}
示例14: ExampleKinesis_CreateStream
func ExampleKinesis_CreateStream() {
svc := kinesis.New(nil)
params := &kinesis.CreateStreamInput{
ShardCount: aws.Long(1), // Required
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.CreateStream(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.StringValue(resp))
}
示例15: ExampleKinesis_PutRecords
func ExampleKinesis_PutRecords() {
svc := kinesis.New(nil)
params := &kinesis.PutRecordsInput{
Records: []*kinesis.PutRecordsRequestEntry{ // Required
{ // Required
Data: []byte("PAYLOAD"), // Required
PartitionKey: aws.String("PartitionKey"), // Required
ExplicitHashKey: aws.String("HashKey"),
},
// More values...
},
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.PutRecords(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.StringValue(resp))
}