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.Prettify(expected), reflect.ValueOf(actual).Kind(), awsutil.Prettify(actual)) } }
func ExampleCloudSearchDomain_UploadDocuments() { svc := cloudsearchdomain.New(nil) params := &cloudsearchdomain.UploadDocumentsInput{ ContentType: aws.String("ContentType"), // Required Documents: bytes.NewReader([]byte("PAYLOAD")), // Required } resp, err := svc.UploadDocuments(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)) }
func ExampleCloudHSM_CreateHsm() { svc := cloudhsm.New(nil) params := &cloudhsm.CreateHsmInput{ IamRoleArn: aws.String("IamRoleArn"), // Required SshKey: aws.String("SshKey"), // Required SubnetId: aws.String("SubnetId"), // Required SubscriptionType: aws.String("SubscriptionType"), // Required ClientToken: aws.String("ClientToken"), EniIp: aws.String("IpAddress"), ExternalId: aws.String("ExternalId"), SyslogIp: aws.String("IpAddress"), } resp, err := svc.CreateHsm(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)) }
func ExampleCloudHSM_ListHsms() { svc := cloudhsm.New(nil) params := &cloudhsm.ListHsmsInput{ NextToken: aws.String("PaginationToken"), } resp, err := svc.ListHsms(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)) }
func ExampleCloudFormation_ValidateTemplate() { svc := cloudformation.New(nil) params := &cloudformation.ValidateTemplateInput{ TemplateBody: aws.String("TemplateBody"), TemplateURL: aws.String("TemplateURL"), } resp, err := svc.ValidateTemplate(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)) }
func ExampleCloudFormation_EstimateTemplateCost() { svc := cloudformation.New(nil) params := &cloudformation.EstimateTemplateCostInput{ Parameters: []*cloudformation.Parameter{ { // Required ParameterKey: aws.String("ParameterKey"), ParameterValue: aws.String("ParameterValue"), UsePreviousValue: aws.Bool(true), }, // More values... }, TemplateBody: aws.String("TemplateBody"), TemplateURL: aws.String("TemplateURL"), } resp, err := svc.EstimateTemplateCost(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)) }
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.Prettify(resp)) }
func ExampleWorkSpaces_DescribeWorkspaceDirectories() { svc := workspaces.New(nil) params := &workspaces.DescribeWorkspaceDirectoriesInput{ DirectoryIds: []*string{ aws.String("DirectoryId"), // Required // More values... }, NextToken: aws.String("PaginationToken"), } resp, err := svc.DescribeWorkspaceDirectories(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)) }
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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleConfigService_DescribeConfigurationRecorderStatus() { svc := configservice.New(nil) params := &configservice.DescribeConfigurationRecorderStatusInput{ ConfigurationRecorderNames: []*string{ aws.String("RecorderName"), // Required // More values... }, } resp, err := svc.DescribeConfigurationRecorderStatus(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)) }
func ExampleConfigService_PutDeliveryChannel() { svc := configservice.New(nil) params := &configservice.PutDeliveryChannelInput{ DeliveryChannel: &configservice.DeliveryChannel{ // Required Name: aws.String("ChannelName"), S3BucketName: aws.String("String"), S3KeyPrefix: aws.String("String"), SnsTopicARN: aws.String("String"), }, } resp, err := svc.PutDeliveryChannel(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)) }
func ExampleConfigService_GetResourceConfigHistory() { svc := configservice.New(nil) params := &configservice.GetResourceConfigHistoryInput{ ResourceId: aws.String("ResourceId"), // Required ResourceType: aws.String("ResourceType"), // Required ChronologicalOrder: aws.String("ChronologicalOrder"), EarlierTime: aws.Time(time.Now()), LaterTime: aws.Time(time.Now()), Limit: aws.Int64(1), NextToken: aws.String("NextToken"), } resp, err := svc.GetResourceConfigHistory(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)) }
func ExampleDynamoDB_ListTables() { svc := dynamodb.New(nil) params := &dynamodb.ListTablesInput{ ExclusiveStartTableName: aws.String("TableName"), Limit: aws.Int64(1), } resp, err := svc.ListTables(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)) }
func ExampleSTS_AssumeRoleWithWebIdentity() { svc := sts.New(nil) params := &sts.AssumeRoleWithWebIdentityInput{ RoleArn: aws.String("arnType"), // Required RoleSessionName: aws.String("userNameType"), // Required WebIdentityToken: aws.String("clientTokenType"), // Required DurationSeconds: aws.Int64(1), Policy: aws.String("sessionPolicyDocumentType"), ProviderId: aws.String("urlType"), } resp, err := svc.AssumeRoleWithWebIdentity(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)) }
func ExampleSTS_GetSessionToken() { svc := sts.New(nil) params := &sts.GetSessionTokenInput{ DurationSeconds: aws.Int64(1), SerialNumber: aws.String("serialNumberType"), TokenCode: aws.String("tokenCodeType"), } resp, err := svc.GetSessionToken(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)) }
func ExampleCloudWatchLogs_TestMetricFilter() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.TestMetricFilterInput{ FilterPattern: aws.String("FilterPattern"), // Required LogEventMessages: []*string{ // Required aws.String("EventMessage"), // Required // More values... }, } resp, err := svc.TestMetricFilter(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)) }
func ExampleCloudWatchLogs_DeleteDestination() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.DeleteDestinationInput{ DestinationName: aws.String("DestinationName"), // Required } resp, err := svc.DeleteDestination(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)) }
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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleSNS_AddPermission() { svc := sns.New(nil) params := &sns.AddPermissionInput{ AWSAccountId: []*string{ // Required aws.String("delegate"), // Required // More values... }, ActionName: []*string{ // Required aws.String("action"), // Required // More values... }, Label: aws.String("label"), // Required TopicArn: aws.String("topicARN"), // Required } resp, err := svc.AddPermission(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)) }
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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleSNS_CreatePlatformApplication() { svc := sns.New(nil) params := &sns.CreatePlatformApplicationInput{ Attributes: map[string]*string{ // Required "Key": aws.String("String"), // Required // More values... }, Name: aws.String("String"), // Required Platform: aws.String("String"), // Required } resp, err := svc.CreatePlatformApplication(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)) }
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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCloudFormation_SignalResource() { svc := cloudformation.New(nil) params := &cloudformation.SignalResourceInput{ LogicalResourceId: aws.String("LogicalResourceId"), // Required StackName: aws.String("StackNameOrId"), // Required Status: aws.String("ResourceSignalStatus"), // Required UniqueId: aws.String("ResourceSignalUniqueId"), // Required } resp, err := svc.SignalResource(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)) }
func ExampleRoute53_UpdateHealthCheck() { svc := route53.New(nil) params := &route53.UpdateHealthCheckInput{ HealthCheckId: aws.String("HealthCheckId"), // Required FailureThreshold: aws.Int64(1), FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"), HealthCheckVersion: aws.Int64(1), IPAddress: aws.String("IPAddress"), Port: aws.Int64(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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleDeviceFarm_CreateUpload() { svc := devicefarm.New(nil) params := &devicefarm.CreateUploadInput{ Name: aws.String("Name"), // Required ProjectArn: aws.String("AmazonResourceName"), // Required Type: aws.String("UploadType"), // Required ContentType: aws.String("ContentType"), } resp, err := svc.CreateUpload(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)) }
func ExampleRoute53_UpdateHostedZoneComment() { svc := route53.New(nil) params := &route53.UpdateHostedZoneCommentInput{ Id: aws.String("ResourceId"), // Required Comment: aws.String("ResourceDescription"), } resp, err := svc.UpdateHostedZoneComment(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)) }
func ExampleCloudHSM_ModifyHapg() { svc := cloudhsm.New(nil) params := &cloudhsm.ModifyHapgInput{ HapgArn: aws.String("HapgArn"), // Required Label: aws.String("Label"), PartitionSerialList: []*string{ aws.String("PartitionSerial"), // Required // More values... }, } resp, err := svc.ModifyHapg(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)) }
func ExampleCloudWatchLogs_DescribeSubscriptionFilters() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.DescribeSubscriptionFiltersInput{ LogGroupName: aws.String("LogGroupName"), // Required FilterNamePrefix: aws.String("FilterName"), Limit: aws.Int64(1), NextToken: aws.String("NextToken"), } resp, err := svc.DescribeSubscriptionFilters(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)) }
func ExampleCloudHSM_CreateLunaClient() { svc := cloudhsm.New(nil) params := &cloudhsm.CreateLunaClientInput{ Certificate: aws.String("Certificate"), // Required Label: aws.String("ClientLabel"), } resp, err := svc.CreateLunaClient(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)) }
func ExampleCloudWatchLogs_PutLogEvents() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.PutLogEventsInput{ LogEvents: []*cloudwatchlogs.InputLogEvent{ // Required { // Required Message: aws.String("EventMessage"), // Required Timestamp: aws.Int64(1), // Required }, // More values... }, LogGroupName: aws.String("LogGroupName"), // Required LogStreamName: aws.String("LogStreamName"), // Required SequenceToken: aws.String("SequenceToken"), } resp, err := svc.PutLogEvents(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)) }