本文整理汇总了Golang中github.com/somathor/aws-sdk-go/aws.Bool函数的典型用法代码示例。如果您正苦于以下问题:Golang Bool函数的具体用法?Golang Bool怎么用?Golang Bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Bool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleOpsWorks_UpdateInstance
func ExampleOpsWorks_UpdateInstance() {
svc := opsworks.New(session.New())
params := &opsworks.UpdateInstanceInput{
InstanceId: aws.String("String"), // Required
AgentVersion: aws.String("String"),
AmiId: aws.String("String"),
Architecture: aws.String("Architecture"),
AutoScalingType: aws.String("AutoScalingType"),
EbsOptimized: aws.Bool(true),
Hostname: aws.String("String"),
InstallUpdatesOnBoot: aws.Bool(true),
InstanceType: aws.String("String"),
LayerIds: []*string{
aws.String("String"), // Required
// More values...
},
Os: aws.String("String"),
SshKeyName: aws.String("String"),
}
resp, err := svc.UpdateInstance(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例2: ExampleRoute53_CreateHealthCheck
func ExampleRoute53_CreateHealthCheck() {
svc := route53.New(session.New())
params := &route53.CreateHealthCheckInput{
CallerReference: aws.String("HealthCheckNonce"), // Required
HealthCheckConfig: &route53.HealthCheckConfig{ // Required
Type: aws.String("HealthCheckType"), // Required
ChildHealthChecks: []*string{
aws.String("HealthCheckId"), // Required
// More values...
},
FailureThreshold: aws.Int64(1),
FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"),
HealthThreshold: aws.Int64(1),
IPAddress: aws.String("IPAddress"),
Inverted: aws.Bool(true),
MeasureLatency: aws.Bool(true),
Port: aws.Int64(1),
RequestInterval: aws.Int64(1),
ResourcePath: aws.String("ResourcePath"),
SearchString: aws.String("SearchString"),
},
}
resp, err := svc.CreateHealthCheck(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例3: ExampleOpsWorks_CreateApp
func ExampleOpsWorks_CreateApp() {
svc := opsworks.New(session.New())
params := &opsworks.CreateAppInput{
Name: aws.String("String"), // Required
StackId: aws.String("String"), // Required
Type: aws.String("AppType"), // Required
AppSource: &opsworks.Source{
Password: aws.String("String"),
Revision: aws.String("String"),
SshKey: aws.String("String"),
Type: aws.String("SourceType"),
Url: aws.String("String"),
Username: aws.String("String"),
},
Attributes: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
DataSources: []*opsworks.DataSource{
{ // Required
Arn: aws.String("String"),
DatabaseName: aws.String("String"),
Type: aws.String("String"),
},
// More values...
},
Description: aws.String("String"),
Domains: []*string{
aws.String("String"), // Required
// More values...
},
EnableSsl: aws.Bool(true),
Environment: []*opsworks.EnvironmentVariable{
{ // Required
Key: aws.String("String"), // Required
Value: aws.String("String"), // Required
Secure: aws.Bool(true),
},
// More values...
},
Shortname: aws.String("String"),
SslConfiguration: &opsworks.SslConfiguration{
Certificate: aws.String("String"), // Required
PrivateKey: aws.String("String"), // Required
Chain: aws.String("String"),
},
}
resp, err := svc.CreateApp(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例4: ExampleOpsWorks_CloneStack
func ExampleOpsWorks_CloneStack() {
svc := opsworks.New(session.New())
params := &opsworks.CloneStackInput{
ServiceRoleArn: aws.String("String"), // Required
SourceStackId: aws.String("String"), // Required
AgentVersion: aws.String("String"),
Attributes: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
ChefConfiguration: &opsworks.ChefConfiguration{
BerkshelfVersion: aws.String("String"),
ManageBerkshelf: aws.Bool(true),
},
CloneAppIds: []*string{
aws.String("String"), // Required
// More values...
},
ClonePermissions: aws.Bool(true),
ConfigurationManager: &opsworks.StackConfigurationManager{
Name: aws.String("String"),
Version: aws.String("String"),
},
CustomCookbooksSource: &opsworks.Source{
Password: aws.String("String"),
Revision: aws.String("String"),
SshKey: aws.String("String"),
Type: aws.String("SourceType"),
Url: aws.String("String"),
Username: aws.String("String"),
},
CustomJson: aws.String("String"),
DefaultAvailabilityZone: aws.String("String"),
DefaultInstanceProfileArn: aws.String("String"),
DefaultOs: aws.String("String"),
DefaultRootDeviceType: aws.String("RootDeviceType"),
DefaultSshKeyName: aws.String("String"),
DefaultSubnetId: aws.String("String"),
HostnameTheme: aws.String("String"),
Name: aws.String("String"),
Region: aws.String("String"),
UseCustomCookbooks: aws.Bool(true),
UseOpsworksSecurityGroups: aws.Bool(true),
VpcId: aws.String("String"),
}
resp, err := svc.CloneStack(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例5: ExampleOpsWorks_CreateInstance
func ExampleOpsWorks_CreateInstance() {
svc := opsworks.New(session.New())
params := &opsworks.CreateInstanceInput{
InstanceType: aws.String("String"), // Required
LayerIds: []*string{ // Required
aws.String("String"), // Required
// More values...
},
StackId: aws.String("String"), // Required
AgentVersion: aws.String("String"),
AmiId: aws.String("String"),
Architecture: aws.String("Architecture"),
AutoScalingType: aws.String("AutoScalingType"),
AvailabilityZone: aws.String("String"),
BlockDeviceMappings: []*opsworks.BlockDeviceMapping{
{ // Required
DeviceName: aws.String("String"),
Ebs: &opsworks.EbsBlockDevice{
DeleteOnTermination: aws.Bool(true),
Iops: aws.Int64(1),
SnapshotId: aws.String("String"),
VolumeSize: aws.Int64(1),
VolumeType: aws.String("VolumeType"),
},
NoDevice: aws.String("String"),
VirtualName: aws.String("String"),
},
// More values...
},
EbsOptimized: aws.Bool(true),
Hostname: aws.String("String"),
InstallUpdatesOnBoot: aws.Bool(true),
Os: aws.String("String"),
RootDeviceType: aws.String("RootDeviceType"),
SshKeyName: aws.String("String"),
SubnetId: aws.String("String"),
VirtualizationType: aws.String("String"),
}
resp, err := svc.CreateInstance(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例6: ExampleS3_DeleteObjects
func ExampleS3_DeleteObjects() {
svc := s3.New(session.New())
params := &s3.DeleteObjectsInput{
Bucket: aws.String("BucketName"), // Required
Delete: &s3.Delete{ // Required
Objects: []*s3.ObjectIdentifier{ // Required
{ // Required
Key: aws.String("ObjectKey"), // Required
VersionId: aws.String("ObjectVersionId"),
},
// More values...
},
Quiet: aws.Bool(true),
},
MFA: aws.String("MFA"),
RequestPayer: aws.String("RequestPayer"),
}
resp, err := svc.DeleteObjects(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例7: ExampleRoute53_CreateHostedZone
func ExampleRoute53_CreateHostedZone() {
svc := route53.New(session.New())
params := &route53.CreateHostedZoneInput{
CallerReference: aws.String("Nonce"), // Required
Name: aws.String("DNSName"), // Required
DelegationSetId: aws.String("ResourceId"),
HostedZoneConfig: &route53.HostedZoneConfig{
Comment: aws.String("ResourceDescription"),
PrivateZone: aws.Bool(true),
},
VPC: &route53.VPC{
VPCId: aws.String("VPCId"),
VPCRegion: aws.String("VPCRegion"),
},
}
resp, err := svc.CreateHostedZone(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例8: TestPaginationTruncation
// Use S3 for simplicity
func TestPaginationTruncation(t *testing.T) {
client := s3.New(unit.Session)
reqNum := 0
resps := []*s3.ListObjectsOutput{
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}},
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}},
{IsTruncated: aws.Bool(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}},
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}},
}
client.Handlers.Send.Clear() // mock sending
client.Handlers.Unmarshal.Clear()
client.Handlers.UnmarshalMeta.Clear()
client.Handlers.ValidateResponse.Clear()
client.Handlers.Unmarshal.PushBack(func(r *request.Request) {
r.Data = resps[reqNum]
reqNum++
})
params := &s3.ListObjectsInput{Bucket: aws.String("bucket")}
results := []string{}
err := client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
results = append(results, *p.Contents[0].Key)
return true
})
assert.Equal(t, []string{"Key1", "Key2", "Key3"}, results)
assert.Nil(t, err)
// Try again without truncation token at all
reqNum = 0
resps[1].IsTruncated = nil
resps[2].IsTruncated = aws.Bool(true)
results = []string{}
err = client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
results = append(results, *p.Contents[0].Key)
return true
})
assert.Equal(t, []string{"Key1", "Key2"}, results)
assert.Nil(t, err)
}
示例9: BenchmarkEC2QueryBuild_Simple_ec2AttachNetworkInterface
func BenchmarkEC2QueryBuild_Simple_ec2AttachNetworkInterface(b *testing.B) {
params := &ec2.AttachNetworkInterfaceInput{
DeviceIndex: aws.Int64(1), // Required
InstanceId: aws.String("String"), // Required
NetworkInterfaceId: aws.String("String"), // Required
DryRun: aws.Bool(true),
}
benchEC2QueryBuild(b, "AttachNetworkInterface", params)
}
示例10: TestMultipleHandlers
func TestMultipleHandlers(t *testing.T) {
r := &request.Request{}
l := request.HandlerList{}
l.PushBack(func(r *request.Request) { r.Data = nil })
l.PushFront(func(r *request.Request) { r.Data = aws.Bool(true) })
l.Run(r)
if r.Data != nil {
t.Error("Expected handler to execute")
}
}
示例11: ExampleRoute53_ChangeResourceRecordSets
func ExampleRoute53_ChangeResourceRecordSets() {
svc := route53.New(session.New())
params := &route53.ChangeResourceRecordSetsInput{
ChangeBatch: &route53.ChangeBatch{ // Required
Changes: []*route53.Change{ // Required
{ // Required
Action: aws.String("ChangeAction"), // Required
ResourceRecordSet: &route53.ResourceRecordSet{ // Required
Name: aws.String("DNSName"), // Required
Type: aws.String("RRType"), // Required
AliasTarget: &route53.AliasTarget{
DNSName: aws.String("DNSName"), // Required
EvaluateTargetHealth: aws.Bool(true), // Required
HostedZoneId: aws.String("ResourceId"), // Required
},
Failover: aws.String("ResourceRecordSetFailover"),
GeoLocation: &route53.GeoLocation{
ContinentCode: aws.String("GeoLocationContinentCode"),
CountryCode: aws.String("GeoLocationCountryCode"),
SubdivisionCode: aws.String("GeoLocationSubdivisionCode"),
},
HealthCheckId: aws.String("HealthCheckId"),
Region: aws.String("ResourceRecordSetRegion"),
ResourceRecords: []*route53.ResourceRecord{
{ // Required
Value: aws.String("RData"), // Required
},
// More values...
},
SetIdentifier: aws.String("ResourceRecordSetIdentifier"),
TTL: aws.Int64(1),
TrafficPolicyInstanceId: aws.String("TrafficPolicyInstanceId"),
Weight: aws.Int64(1),
},
},
// More values...
},
Comment: aws.String("ResourceDescription"),
},
HostedZoneId: aws.String("ResourceId"), // Required
}
resp, err := svc.ChangeResourceRecordSets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例12: ExampleOpsWorks_DeleteInstance
func ExampleOpsWorks_DeleteInstance() {
svc := opsworks.New(session.New())
params := &opsworks.DeleteInstanceInput{
InstanceId: aws.String("String"), // Required
DeleteElasticIp: aws.Bool(true),
DeleteVolumes: aws.Bool(true),
}
resp, err := svc.DeleteInstance(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例13: ExampleOpsWorks_SetPermission
func ExampleOpsWorks_SetPermission() {
svc := opsworks.New(session.New())
params := &opsworks.SetPermissionInput{
IamUserArn: aws.String("String"), // Required
StackId: aws.String("String"), // Required
AllowSsh: aws.Bool(true),
AllowSudo: aws.Bool(true),
Level: aws.String("String"),
}
resp, err := svc.SetPermission(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例14: TestCopySourceSSECustomerKeyOverHTTPError
func TestCopySourceSSECustomerKeyOverHTTPError(t *testing.T) {
s := s3.New(unit.Session, &aws.Config{DisableSSL: aws.Bool(true)})
req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{
Bucket: aws.String("bucket"),
CopySource: aws.String("bucket/source"),
Key: aws.String("dest"),
CopySourceSSECustomerKey: aws.String("key"),
})
err := req.Build()
assert.Error(t, err)
assert.Equal(t, "ConfigError", err.(awserr.Error).Code())
assert.Contains(t, err.(awserr.Error).Message(), "cannot send SSE keys over HTTP")
}
示例15: TestNoErrors
func TestNoErrors(t *testing.T) {
input := &StructShape{
RequiredList: []*ConditionalStructShape{},
RequiredMap: map[string]*ConditionalStructShape{
"key1": {Name: aws.String("Name")},
"key2": {Name: aws.String("Name")},
},
RequiredBool: aws.Bool(true),
OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")},
}
req := testSvc.NewRequest(&request.Operation{}, input, nil)
corehandlers.ValidateParametersHandler.Fn(req)
require.NoError(t, req.Error)
}