本文整理汇总了Golang中github.com/aws/aws-sdk-go/aws.Boolean函数的典型用法代码示例。如果您正苦于以下问题:Golang Boolean函数的具体用法?Golang Boolean怎么用?Golang Boolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Boolean函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleRoute53Domains_UpdateDomainContactPrivacy
func ExampleRoute53Domains_UpdateDomainContactPrivacy() {
svc := route53domains.New(nil)
params := &route53domains.UpdateDomainContactPrivacyInput{
DomainName: aws.String("DomainName"), // Required
AdminPrivacy: aws.Boolean(true),
RegistrantPrivacy: aws.Boolean(true),
TechPrivacy: aws.Boolean(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.StringValue(resp))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:29,代码来源:examples_test.go
示例2: resourceAwsInstanceUpdate
func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
d.Partial(true)
if err := setTags(conn, d); err != nil {
return err
} else {
d.SetPartial("tags")
}
// SourceDestCheck can only be set on VPC instances
if d.Get("subnet_id").(string) != "" {
log.Printf("[INFO] Modifying instance %s", d.Id())
_, err := conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
InstanceID: aws.String(d.Id()),
SourceDestCheck: &ec2.AttributeBooleanValue{
Value: aws.Boolean(d.Get("source_dest_check").(bool)),
},
})
if err != nil {
return err
}
}
if d.HasChange("vpc_security_group_ids") {
var groups []*string
if v := d.Get("vpc_security_group_ids").(*schema.Set); v.Len() > 0 {
for _, v := range v.List() {
groups = append(groups, aws.String(v.(string)))
}
}
_, err := conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
InstanceID: aws.String(d.Id()),
Groups: groups,
})
if err != nil {
return err
}
}
if d.HasChange("disable_api_termination") {
_, err := conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
InstanceID: aws.String(d.Id()),
DisableAPITermination: &ec2.AttributeBooleanValue{
Value: aws.Boolean(d.Get("disable_api_termination").(bool)),
},
})
if err != nil {
return err
}
}
// TODO(mitchellh): wait for the attributes we modified to
// persist the change...
d.Partial(false)
return resourceAwsInstanceRead(d, meta)
}
开发者ID:solarnz,项目名称:terraform,代码行数:59,代码来源:resource_aws_instance.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.Boolean(true), // Required
S3Origin: &cloudfront.S3Origin{ // Required
DomainName: aws.String("string"), // Required
OriginAccessIdentity: aws.String("string"), // Required
},
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Boolean(true), // Required
Quantity: aws.Long(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Long(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Logging: &cloudfront.StreamingLoggingConfig{
Bucket: aws.String("string"), // Required
Enabled: aws.Boolean(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.StringValue(resp))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:57,代码来源:examples_test.go
示例4: copyMetricsMetadata
// copyMetricsMetadata creates a new MetricsMetadata object from a given MetricsMetadata object.
// It copies all the fields from the source object to the new object and sets the 'Fin' field
// as specified by the argument.
func copyMetricsMetadata(metadata *ecstcs.MetricsMetadata, fin bool) *ecstcs.MetricsMetadata {
return &ecstcs.MetricsMetadata{
Cluster: aws.String(*metadata.Cluster),
ContainerInstance: aws.String(*metadata.ContainerInstance),
Idle: aws.Boolean(*metadata.Idle),
MessageId: aws.String(*metadata.MessageId),
Fin: aws.Boolean(fin),
}
}
开发者ID:rafkhan,项目名称:amazon-ecs-agent,代码行数:12,代码来源:client.go
示例5: 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.Boolean(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.Boolean(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.Long(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.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:56,代码来源:examples_test.go
示例6: ExampleCodePipeline_CreateCustomActionType
func ExampleCodePipeline_CreateCustomActionType() {
svc := codepipeline.New(nil)
params := &codepipeline.CreateCustomActionTypeInput{
Category: aws.String("ActionCategory"), // Required
InputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
MaximumCount: aws.Long(1), // Required
MinimumCount: aws.Long(1), // Required
},
OutputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
MaximumCount: aws.Long(1), // Required
MinimumCount: aws.Long(1), // Required
},
Provider: aws.String("ActionProvider"), // Required
Version: aws.String("Version"), // Required
ConfigurationProperties: []*codepipeline.ActionConfigurationProperty{
{ // Required
Key: aws.Boolean(true), // Required
Name: aws.String("ActionConfigurationKey"), // Required
Required: aws.Boolean(true), // Required
Secret: aws.Boolean(true), // Required
Description: aws.String("Description"),
Queryable: aws.Boolean(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.StringValue(resp))
}
开发者ID:marciol,项目名称:aws-sdk-go,代码行数:54,代码来源:examples_test.go
示例7: ExampleElastiCache_ModifyCacheCluster
func ExampleElastiCache_ModifyCacheCluster() {
svc := elasticache.New(nil)
params := &elasticache.ModifyCacheClusterInput{
CacheClusterID: aws.String("String"), // Required
AZMode: aws.String("AZMode"),
ApplyImmediately: aws.Boolean(true),
AutoMinorVersionUpgrade: aws.Boolean(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.Long(1),
PreferredMaintenanceWindow: aws.String("String"),
SecurityGroupIDs: []*string{
aws.String("String"), // Required
// More values...
},
SnapshotRetentionLimit: aws.Long(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.StringValue(resp))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:53,代码来源:examples_test.go
示例8: ExampleELB_ModifyLoadBalancerAttributes
func ExampleELB_ModifyLoadBalancerAttributes() {
svc := elb.New(nil)
params := &elb.ModifyLoadBalancerAttributesInput{
LoadBalancerAttributes: &elb.LoadBalancerAttributes{ // Required
AccessLog: &elb.AccessLog{
Enabled: aws.Boolean(true), // Required
EmitInterval: aws.Long(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.Boolean(true), // Required
Timeout: aws.Long(1),
},
ConnectionSettings: &elb.ConnectionSettings{
IdleTimeout: aws.Long(1), // Required
},
CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{
Enabled: aws.Boolean(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.StringValue(resp))
}
开发者ID:nickschuch,项目名称:kube-haproxy,代码行数:51,代码来源:examples_test.go
示例9: CreateLoadBalancer
// CreateLoadBalancer creates a new ELB:
//
// * The ELB is created and connection draining is enabled.
// * An internal DNS CNAME record is created, pointing the the DNSName of the ELB.
func (m *ELBManager) CreateLoadBalancer(ctx context.Context, o CreateLoadBalancerOpts) (*LoadBalancer, error) {
scheme := schemeInternal
sg := m.InternalSecurityGroupID
subnets := m.internalSubnets()
if o.External {
scheme = schemeExternal
sg = m.ExternalSecurityGroupID
subnets = m.externalSubnets()
}
input := &elb.CreateLoadBalancerInput{
Listeners: elbListeners(o.InstancePort, o.SSLCert),
LoadBalancerName: aws.String(m.newName()),
Scheme: aws.String(scheme),
SecurityGroups: []*string{aws.String(sg)},
Subnets: subnets,
Tags: elbTags(o.Tags),
}
// Create the ELB.
out, err := m.elb.CreateLoadBalancer(input)
if err != nil {
return nil, err
}
// Add connection draining to the LoadBalancer.
if _, err := m.elb.ModifyLoadBalancerAttributes(&elb.ModifyLoadBalancerAttributesInput{
LoadBalancerAttributes: &elb.LoadBalancerAttributes{
ConnectionDraining: &elb.ConnectionDraining{
Enabled: aws.Boolean(true),
Timeout: aws.Long(defaultConnectionDrainingTimeout),
},
CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{
Enabled: aws.Boolean(true),
},
},
LoadBalancerName: input.LoadBalancerName,
}); err != nil {
return nil, err
}
return &LoadBalancer{
Name: *input.LoadBalancerName,
DNSName: *out.DNSName,
External: o.External,
SSLCert: o.SSLCert,
InstancePort: o.InstancePort,
}, nil
}
开发者ID:zofuthan,项目名称:empire,代码行数:54,代码来源:elb.go
示例10: TestBlockDevice
func TestBlockDevice(t *testing.T) {
cases := []struct {
Config *BlockDevice
Result *ec2.BlockDeviceMapping
}{
{
Config: &BlockDevice{
DeviceName: "/dev/sdb",
VirtualName: "ephemeral0",
SnapshotId: "snap-1234",
VolumeType: "standard",
VolumeSize: 8,
DeleteOnTermination: true,
IOPS: 1000,
},
Result: &ec2.BlockDeviceMapping{
DeviceName: aws.String("/dev/sdb"),
VirtualName: aws.String("ephemeral0"),
EBS: &ec2.EBSBlockDevice{
Encrypted: aws.Boolean(false),
SnapshotID: aws.String("snap-1234"),
VolumeType: aws.String("standard"),
VolumeSize: aws.Long(8),
DeleteOnTermination: aws.Boolean(true),
IOPS: aws.Long(1000),
},
},
},
}
for _, tc := range cases {
blockDevices := BlockDevices{
AMIMappings: []BlockDevice{*tc.Config},
LaunchMappings: []BlockDevice{*tc.Config},
}
expected := []*ec2.BlockDeviceMapping{tc.Result}
got := blockDevices.BuildAMIDevices()
if !reflect.DeepEqual(expected, got) {
t.Fatalf("bad: %#v", expected)
}
if !reflect.DeepEqual(expected, blockDevices.BuildLaunchDevices()) {
t.Fatalf("bad: %#v", expected)
}
}
}
开发者ID:henrysher,项目名称:packer,代码行数:48,代码来源:block_device_test.go
示例11: ExampleElastiCache_DescribeCacheEngineVersions
func ExampleElastiCache_DescribeCacheEngineVersions() {
svc := elasticache.New(nil)
params := &elasticache.DescribeCacheEngineVersionsInput{
CacheParameterGroupFamily: aws.String("String"),
DefaultOnly: aws.Boolean(true),
Engine: aws.String("String"),
EngineVersion: aws.String("String"),
Marker: aws.String("String"),
MaxRecords: aws.Long(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.StringValue(resp))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go
示例12: ExampleElastiCache_DeleteReplicationGroup
func ExampleElastiCache_DeleteReplicationGroup() {
svc := elasticache.New(nil)
params := &elasticache.DeleteReplicationGroupInput{
ReplicationGroupID: aws.String("String"), // Required
FinalSnapshotIdentifier: aws.String("String"),
RetainPrimaryCluster: aws.Boolean(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.StringValue(resp))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例13: 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.Boolean(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.StringValue(resp))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:34,代码来源:examples_test.go
示例14: ExampleECS_DeregisterContainerInstance
func ExampleECS_DeregisterContainerInstance() {
svc := ecs.New(nil)
params := &ecs.DeregisterContainerInstanceInput{
ContainerInstance: aws.String("String"), // Required
Cluster: aws.String("String"),
Force: aws.Boolean(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.StringValue(resp))
}
开发者ID:nickschuch,项目名称:kube-haproxy,代码行数:28,代码来源:examples_test.go
示例15: 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.Boolean(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.StringValue(resp))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:34,代码来源:examples_test.go
示例16: 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.Long(1),
NextPageToken: aws.String("PageToken"),
ReverseOrder: aws.Boolean(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.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:33,代码来源:examples_test.go
示例17: resourceAwsNetworkInterfaceDetach
func resourceAwsNetworkInterfaceDetach(oa *schema.Set, meta interface{}, eniId string) error {
// if there was an old attachment, remove it
if oa != nil && len(oa.List()) > 0 {
old_attachment := oa.List()[0].(map[string]interface{})
detach_request := &ec2.DetachNetworkInterfaceInput{
AttachmentID: aws.String(old_attachment["attachment_id"].(string)),
Force: aws.Boolean(true),
}
conn := meta.(*AWSClient).ec2conn
_, detach_err := conn.DetachNetworkInterface(detach_request)
if detach_err != nil {
return fmt.Errorf("Error detaching ENI: %s", detach_err)
}
log.Printf("[DEBUG] Waiting for ENI (%s) to become dettached", eniId)
stateConf := &resource.StateChangeConf{
Pending: []string{"true"},
Target: "false",
Refresh: networkInterfaceAttachmentRefreshFunc(conn, eniId),
Timeout: 10 * time.Minute,
}
if _, err := stateConf.WaitForState(); err != nil {
return fmt.Errorf(
"Error waiting for ENI (%s) to become dettached: %s", eniId, err)
}
}
return nil
}
开发者ID:nlamirault,项目名称:terraform,代码行数:29,代码来源:resource_aws_network_interface.go
示例18: ExampleAutoScaling_DeleteTags
func ExampleAutoScaling_DeleteTags() {
svc := autoscaling.New(nil)
params := &autoscaling.DeleteTagsInput{
Tags: []*autoscaling.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
PropagateAtLaunch: aws.Boolean(true),
ResourceID: aws.String("XmlString"),
ResourceType: aws.String("XmlString"),
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.DeleteTags(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))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:35,代码来源:examples_test.go
示例19: ExampleCloudFormation_EstimateTemplateCost
func ExampleCloudFormation_EstimateTemplateCost() {
svc := cloudformation.New(nil)
params := &cloudformation.EstimateTemplateCostInput{
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Boolean(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.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:35,代码来源:examples_test.go
示例20: ExampleCognitoIdentity_ListIdentities
func ExampleCognitoIdentity_ListIdentities() {
svc := cognitoidentity.New(nil)
params := &cognitoidentity.ListIdentitiesInput{
IdentityPoolID: aws.String("IdentityPoolId"), // Required
MaxResults: aws.Long(1), // Required
HideDisabled: aws.Boolean(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.StringValue(resp))
}
开发者ID:rail,项目名称:aws-sdk-go,代码行数:29,代码来源:examples_test.go
注:本文中的github.com/aws/aws-sdk-go/aws.Boolean函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论