本文整理匯總了Golang中github.com/aws/aws-sdk-go/aws.Boolean函數的典型用法代碼示例。如果您正苦於以下問題:Golang Boolean函數的具體用法?Golang Boolean怎麽用?Golang Boolean使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Boolean函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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))
}
示例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)
}
示例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))
}
示例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),
}
}
示例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))
}
示例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))
}
示例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))
}
示例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))
}
示例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
}
示例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)
}
}
}
示例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))
}
示例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))
}
示例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))
}
示例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))
}
示例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))
}