本文整理汇总了Golang中github.com/tetrafolium/aws-sdk-go/aws.Bool函数的典型用法代码示例。如果您正苦于以下问题:Golang Bool函数的具体用法?Golang Bool怎么用?Golang Bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Bool函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleRoute53Domains_UpdateDomainContactPrivacy
func ExampleRoute53Domains_UpdateDomainContactPrivacy() {
svc := route53domains.New(nil)
params := &route53domains.UpdateDomainContactPrivacyInput{
DomainName: aws.String("DomainName"), // Required
AdminPrivacy: aws.Bool(true),
RegistrantPrivacy: aws.Bool(true),
TechPrivacy: aws.Bool(true),
}
resp, err := svc.UpdateDomainContactPrivacy(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:tetrafolium,项目名称:aws-sdk-go,代码行数:29,代码来源:examples_test.go
示例2: ExampleDeviceFarm_ScheduleRun
func ExampleDeviceFarm_ScheduleRun() {
svc := devicefarm.New(nil)
params := &devicefarm.ScheduleRunInput{
AppArn: aws.String("AmazonResourceName"), // Required
DevicePoolArn: aws.String("AmazonResourceName"), // Required
ProjectArn: aws.String("AmazonResourceName"), // Required
Test: &devicefarm.ScheduleRunTest{ // Required
Type: aws.String("TestType"), // Required
Filter: aws.String("Filter"),
Parameters: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
TestPackageArn: aws.String("AmazonResourceName"),
},
Configuration: &devicefarm.ScheduleRunConfiguration{
AuxiliaryApps: []*string{
aws.String("AmazonResourceName"), // Required
// More values...
},
BillingMethod: aws.String("BillingMethod"),
ExtraDataPackageArn: aws.String("AmazonResourceName"),
Locale: aws.String("String"),
Location: &devicefarm.Location{
Latitude: aws.Float64(1.0), // Required
Longitude: aws.Float64(1.0), // Required
},
NetworkProfileArn: aws.String("AmazonResourceName"),
Radios: &devicefarm.Radios{
Bluetooth: aws.Bool(true),
Gps: aws.Bool(true),
Nfc: aws.Bool(true),
Wifi: aws.Bool(true),
},
},
Name: aws.String("Name"),
}
resp, err := svc.ScheduleRun(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:tetrafolium,项目名称:aws-sdk-go,代码行数:58,代码来源:examples_test.go
示例3: ExampleCloudFront_UpdateStreamingDistribution
func ExampleCloudFront_UpdateStreamingDistribution() {
svc := cloudfront.New(nil)
params := &cloudfront.UpdateStreamingDistributionInput{
Id: aws.String("string"), // Required
StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
S3Origin: &cloudfront.S3Origin{ // Required
DomainName: aws.String("string"), // Required
OriginAccessIdentity: aws.String("string"), // Required
},
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Logging: &cloudfront.StreamingLoggingConfig{
Bucket: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
Prefix: aws.String("string"), // Required
},
PriceClass: aws.String("PriceClass"),
},
IfMatch: aws.String("string"),
}
resp, err := svc.UpdateStreamingDistribution(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:tetrafolium,项目名称:aws-sdk-go,代码行数:57,代码来源:examples_test.go
示例4: ExampleCloudFormation_CreateStack
func ExampleCloudFormation_CreateStack() {
svc := cloudformation.New(nil)
params := &cloudformation.CreateStackInput{
StackName: aws.String("StackName"), // Required
Capabilities: []*string{
aws.String("Capability"), // Required
// More values...
},
DisableRollback: aws.Bool(true),
NotificationARNs: []*string{
aws.String("NotificationARN"), // Required
// More values...
},
OnFailure: aws.String("OnFailure"),
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
StackPolicyBody: aws.String("StackPolicyBody"),
StackPolicyURL: aws.String("StackPolicyURL"),
Tags: []*cloudformation.Tag{
{ // Required
Key: aws.String("TagKey"),
Value: aws.String("TagValue"),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
TimeoutInMinutes: aws.Int64(1),
}
resp, err := svc.CreateStack(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:tetrafolium,项目名称:aws-sdk-go,代码行数:56,代码来源:examples_test.go
示例5: ExampleCodePipeline_CreateCustomActionType
func ExampleCodePipeline_CreateCustomActionType() {
svc := codepipeline.New(nil)
params := &codepipeline.CreateCustomActionTypeInput{
Category: aws.String("ActionCategory"), // Required
InputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
MaximumCount: aws.Int64(1), // Required
MinimumCount: aws.Int64(1), // Required
},
OutputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
MaximumCount: aws.Int64(1), // Required
MinimumCount: aws.Int64(1), // Required
},
Provider: aws.String("ActionProvider"), // Required
Version: aws.String("Version"), // Required
ConfigurationProperties: []*codepipeline.ActionConfigurationProperty{
{ // Required
Key: aws.Bool(true), // Required
Name: aws.String("ActionConfigurationKey"), // Required
Required: aws.Bool(true), // Required
Secret: aws.Bool(true), // Required
Description: aws.String("Description"),
Queryable: aws.Bool(true),
Type: aws.String("ActionConfigurationPropertyType"),
},
// More values...
},
Settings: &codepipeline.ActionTypeSettings{
EntityUrlTemplate: aws.String("UrlTemplate"),
ExecutionUrlTemplate: aws.String("UrlTemplate"),
RevisionUrlTemplate: aws.String("UrlTemplate"),
ThirdPartyConfigurationUrl: aws.String("Url"),
},
}
resp, err := svc.CreateCustomActionType(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:tetrafolium,项目名称:aws-sdk-go,代码行数:54,代码来源:examples_test.go
示例6: ExampleElastiCache_ModifyCacheCluster
func ExampleElastiCache_ModifyCacheCluster() {
svc := elasticache.New(nil)
params := &elasticache.ModifyCacheClusterInput{
CacheClusterId: aws.String("String"), // Required
AZMode: aws.String("AZMode"),
ApplyImmediately: aws.Bool(true),
AutoMinorVersionUpgrade: aws.Bool(true),
CacheNodeIdsToRemove: []*string{
aws.String("String"), // Required
// More values...
},
CacheParameterGroupName: aws.String("String"),
CacheSecurityGroupNames: []*string{
aws.String("String"), // Required
// More values...
},
EngineVersion: aws.String("String"),
NewAvailabilityZones: []*string{
aws.String("String"), // Required
// More values...
},
NotificationTopicArn: aws.String("String"),
NotificationTopicStatus: aws.String("String"),
NumCacheNodes: aws.Int64(1),
PreferredMaintenanceWindow: aws.String("String"),
SecurityGroupIds: []*string{
aws.String("String"), // Required
// More values...
},
SnapshotRetentionLimit: aws.Int64(1),
SnapshotWindow: aws.String("String"),
}
resp, err := svc.ModifyCacheCluster(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:tetrafolium,项目名称:aws-sdk-go,代码行数:53,代码来源:examples_test.go
示例7: ExampleELB_ModifyLoadBalancerAttributes
func ExampleELB_ModifyLoadBalancerAttributes() {
svc := elb.New(nil)
params := &elb.ModifyLoadBalancerAttributesInput{
LoadBalancerAttributes: &elb.LoadBalancerAttributes{ // Required
AccessLog: &elb.AccessLog{
Enabled: aws.Bool(true), // Required
EmitInterval: aws.Int64(1),
S3BucketName: aws.String("S3BucketName"),
S3BucketPrefix: aws.String("AccessLogPrefix"),
},
AdditionalAttributes: []*elb.AdditionalAttribute{
{ // Required
Key: aws.String("StringVal"),
Value: aws.String("StringVal"),
},
// More values...
},
ConnectionDraining: &elb.ConnectionDraining{
Enabled: aws.Bool(true), // Required
Timeout: aws.Int64(1),
},
ConnectionSettings: &elb.ConnectionSettings{
IdleTimeout: aws.Int64(1), // Required
},
CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{
Enabled: aws.Bool(true), // Required
},
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.ModifyLoadBalancerAttributes(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:tetrafolium,项目名称:aws-sdk-go,代码行数:51,代码来源:examples_test.go
示例8: ExampleSWF_PollForDecisionTask
func ExampleSWF_PollForDecisionTask() {
svc := swf.New(nil)
params := &swf.PollForDecisionTaskInput{
Domain: aws.String("DomainName"), // Required
TaskList: &swf.TaskList{ // Required
Name: aws.String("Name"), // Required
},
Identity: aws.String("Identity"),
MaximumPageSize: aws.Int64(1),
NextPageToken: aws.String("PageToken"),
ReverseOrder: aws.Bool(true),
}
resp, err := svc.PollForDecisionTask(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:tetrafolium,项目名称:aws-sdk-go,代码行数:33,代码来源:examples_test.go
示例9: ExampleElasticBeanstalk_TerminateEnvironment
func ExampleElasticBeanstalk_TerminateEnvironment() {
svc := elasticbeanstalk.New(nil)
params := &elasticbeanstalk.TerminateEnvironmentInput{
EnvironmentId: aws.String("EnvironmentId"),
EnvironmentName: aws.String("EnvironmentName"),
TerminateResources: aws.Bool(true),
}
resp, err := svc.TerminateEnvironment(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:tetrafolium,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例10: ExampleCognitoIdentity_ListIdentities
func ExampleCognitoIdentity_ListIdentities() {
svc := cognitoidentity.New(nil)
params := &cognitoidentity.ListIdentitiesInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
MaxResults: aws.Int64(1), // Required
HideDisabled: aws.Bool(true),
NextToken: aws.String("PaginationKey"),
}
resp, err := svc.ListIdentities(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:tetrafolium,项目名称:aws-sdk-go,代码行数:29,代码来源:examples_test.go
示例11: AfterRetryHandler
// AfterRetryHandler performs final checks to determine if the request should
// be retried and how long to delay.
func AfterRetryHandler(r *Request) {
// If one of the other handlers already set the retry state
// we don't want to override it based on the service's state
if r.Retryable == nil {
r.Retryable = aws.Bool(r.Service.ShouldRetry(r))
}
if r.WillRetry() {
r.RetryDelay = r.Service.RetryRules(r)
sleepDelay(r.RetryDelay)
// when the expired token exception occurs the credentials
// need to be expired locally so that the next request to
// get credentials will trigger a credentials refresh.
if r.Error != nil {
if err, ok := r.Error.(awserr.Error); ok {
if isCodeExpiredCreds(err.Code()) {
r.Config.Credentials.Expire()
}
}
}
r.RetryCount++
r.Error = nil
}
}
开发者ID:tetrafolium,项目名称:aws-sdk-go,代码行数:28,代码来源:handler_functions.go
示例12: ExampleDataPipeline_DescribeObjects
func ExampleDataPipeline_DescribeObjects() {
svc := datapipeline.New(nil)
params := &datapipeline.DescribeObjectsInput{
ObjectIds: []*string{ // Required
aws.String("id"), // Required
// More values...
},
PipelineId: aws.String("id"), // Required
EvaluateExpressions: aws.Bool(true),
Marker: aws.String("string"),
}
resp, err := svc.DescribeObjects(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:tetrafolium,项目名称:aws-sdk-go,代码行数:32,代码来源:examples_test.go
示例13: ExampleCloudTrail_UpdateTrail
func ExampleCloudTrail_UpdateTrail() {
svc := cloudtrail.New(nil)
params := &cloudtrail.UpdateTrailInput{
Name: aws.String("String"), // Required
CloudWatchLogsLogGroupArn: aws.String("String"),
CloudWatchLogsRoleArn: aws.String("String"),
IncludeGlobalServiceEvents: aws.Bool(true),
S3BucketName: aws.String("String"),
S3KeyPrefix: aws.String("String"),
SnsTopicName: aws.String("String"),
}
resp, err := svc.UpdateTrail(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:tetrafolium,项目名称:aws-sdk-go,代码行数:32,代码来源:examples_test.go
示例14: ExampleElastiCache_DescribeCacheEngineVersions
func ExampleElastiCache_DescribeCacheEngineVersions() {
svc := elasticache.New(nil)
params := &elasticache.DescribeCacheEngineVersionsInput{
CacheParameterGroupFamily: aws.String("String"),
DefaultOnly: aws.Bool(true),
Engine: aws.String("String"),
EngineVersion: aws.String("String"),
Marker: aws.String("String"),
MaxRecords: aws.Int64(1),
}
resp, err := svc.DescribeCacheEngineVersions(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:tetrafolium,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例15: ExampleElastiCache_DeleteReplicationGroup
func ExampleElastiCache_DeleteReplicationGroup() {
svc := elasticache.New(nil)
params := &elasticache.DeleteReplicationGroupInput{
ReplicationGroupId: aws.String("String"), // Required
FinalSnapshotIdentifier: aws.String("String"),
RetainPrimaryCluster: aws.Bool(true),
}
resp, err := svc.DeleteReplicationGroup(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:tetrafolium,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例16: ExampleElastiCache_ResetCacheParameterGroup
func ExampleElastiCache_ResetCacheParameterGroup() {
svc := elasticache.New(nil)
params := &elasticache.ResetCacheParameterGroupInput{
CacheParameterGroupName: aws.String("String"), // Required
ParameterNameValues: []*elasticache.ParameterNameValue{ // Required
{ // Required
ParameterName: aws.String("String"),
ParameterValue: aws.String("String"),
},
// More values...
},
ResetAllParameters: aws.Bool(true),
}
resp, err := svc.ResetCacheParameterGroup(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:tetrafolium,项目名称:aws-sdk-go,代码行数:34,代码来源:examples_test.go
示例17: SendHandler
// SendHandler is a request handler to send service request using HTTP client.
func SendHandler(r *Request) {
var err error
r.HTTPResponse, err = r.Service.Config.HTTPClient.Do(r.HTTPRequest)
if err != nil {
// Capture the case where url.Error is returned for error processing
// response. e.g. 301 without location header comes back as string
// error and r.HTTPResponse is nil. Other url redirect errors will
// comeback in a similar method.
if e, ok := err.(*url.Error); ok {
if s := reStatusCode.FindStringSubmatch(e.Error()); s != nil {
code, _ := strconv.ParseInt(s[1], 10, 64)
r.HTTPResponse = &http.Response{
StatusCode: int(code),
Status: http.StatusText(int(code)),
Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
}
return
}
}
if r.HTTPResponse == nil {
// Add a dummy request response object to ensure the HTTPResponse
// value is consistent.
r.HTTPResponse = &http.Response{
StatusCode: int(0),
Status: http.StatusText(int(0)),
Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
}
}
// Catch all other request errors.
r.Error = awserr.New("RequestError", "send request failed", err)
r.Retryable = aws.Bool(true) // network errors are retryable
}
}
开发者ID:tetrafolium,项目名称:aws-sdk-go,代码行数:34,代码来源:handler_functions.go
示例18: ExampleStorageGateway_CreateStorediSCSIVolume
func ExampleStorageGateway_CreateStorediSCSIVolume() {
svc := storagegateway.New(nil)
params := &storagegateway.CreateStorediSCSIVolumeInput{
DiskId: aws.String("DiskId"), // Required
GatewayARN: aws.String("GatewayARN"), // Required
NetworkInterfaceId: aws.String("NetworkInterfaceId"), // Required
PreserveExistingData: aws.Bool(true), // Required
TargetName: aws.String("TargetName"), // Required
SnapshotId: aws.String("SnapshotId"),
}
resp, err := svc.CreateStorediSCSIVolume(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:tetrafolium,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例19: ExampleECS_DeregisterContainerInstance
func ExampleECS_DeregisterContainerInstance() {
svc := ecs.New(nil)
params := &ecs.DeregisterContainerInstanceInput{
ContainerInstance: aws.String("String"), // Required
Cluster: aws.String("String"),
Force: aws.Bool(true),
}
resp, err := svc.DeregisterContainerInstance(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:tetrafolium,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例20: ExampleMachineLearning_CreateDataSourceFromS3
func ExampleMachineLearning_CreateDataSourceFromS3() {
svc := machinelearning.New(nil)
params := &machinelearning.CreateDataSourceFromS3Input{
DataSourceId: aws.String("EntityId"), // Required
DataSpec: &machinelearning.S3DataSpec{ // Required
DataLocationS3: aws.String("S3Url"), // Required
DataRearrangement: aws.String("DataRearrangement"),
DataSchema: aws.String("DataSchema"),
DataSchemaLocationS3: aws.String("S3Url"),
},
ComputeStatistics: aws.Bool(true),
DataSourceName: aws.String("EntityName"),
}
resp, err := svc.CreateDataSourceFromS3(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:tetrafolium,项目名称:aws-sdk-go,代码行数:34,代码来源:examples_test.go
注:本文中的github.com/tetrafolium/aws-sdk-go/aws.Bool函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论