本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/aws.Long函数的典型用法代码示例。如果您正苦于以下问题:Golang Long函数的具体用法?Golang Long怎么用?Golang Long使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Long函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleAutoScaling_PutScalingPolicy
func ExampleAutoScaling_PutScalingPolicy() {
svc := autoscaling.New(nil)
params := &autoscaling.PutScalingPolicyInput{
AdjustmentType: aws.String("XmlStringMaxLen255"), // Required
AutoScalingGroupName: aws.String("ResourceName"), // Required
PolicyName: aws.String("XmlStringMaxLen255"), // Required
ScalingAdjustment: aws.Long(1), // Required
Cooldown: aws.Long(1),
MinAdjustmentStep: aws.Long(1),
}
resp, err := svc.PutScalingPolicy(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:ninefive,项目名称:confd,代码行数:31,代码来源:examples_test.go
示例2: ExampleStorageGateway_CreateTapes
func ExampleStorageGateway_CreateTapes() {
svc := storagegateway.New(nil)
params := &storagegateway.CreateTapesInput{
ClientToken: aws.String("ClientToken"), // Required
GatewayARN: aws.String("GatewayARN"), // Required
NumTapesToCreate: aws.Long(1), // Required
TapeBarcodePrefix: aws.String("TapeBarcodePrefix"), // Required
TapeSizeInBytes: aws.Long(1), // Required
}
resp, err := svc.CreateTapes(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:30,代码来源:examples_test.go
示例3: ExampleStorageGateway_UpdateSnapshotSchedule
func ExampleStorageGateway_UpdateSnapshotSchedule() {
svc := storagegateway.New(nil)
params := &storagegateway.UpdateSnapshotScheduleInput{
RecurrenceInHours: aws.Long(1), // Required
StartAt: aws.Long(1), // Required
VolumeARN: aws.String("VolumeARN"), // Required
Description: aws.String("Description"),
}
resp, err := svc.UpdateSnapshotSchedule(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:29,代码来源:examples_test.go
示例4: ExampleStorageGateway_UpdateMaintenanceStartTime
func ExampleStorageGateway_UpdateMaintenanceStartTime() {
svc := storagegateway.New(nil)
params := &storagegateway.UpdateMaintenanceStartTimeInput{
DayOfWeek: aws.Long(1), // Required
GatewayARN: aws.String("GatewayARN"), // Required
HourOfDay: aws.Long(1), // Required
MinuteOfHour: aws.Long(1), // Required
}
resp, err := svc.UpdateMaintenanceStartTime(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:29,代码来源:examples_test.go
示例5: ExampleAutoScaling_PutScheduledUpdateGroupAction
func ExampleAutoScaling_PutScheduledUpdateGroupAction() {
svc := autoscaling.New(nil)
params := &autoscaling.PutScheduledUpdateGroupActionInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
ScheduledActionName: aws.String("XmlStringMaxLen255"), // Required
DesiredCapacity: aws.Long(1),
EndTime: aws.Time(time.Now()),
MaxSize: aws.Long(1),
MinSize: aws.Long(1),
Recurrence: aws.String("XmlStringMaxLen255"),
StartTime: aws.Time(time.Now()),
Time: aws.Time(time.Now()),
}
resp, err := svc.PutScheduledUpdateGroupAction(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:ninefive,项目名称:confd,代码行数:34,代码来源:examples_test.go
示例6: ExampleCloudWatchLogs_GetLogEvents
func ExampleCloudWatchLogs_GetLogEvents() {
svc := cloudwatchlogs.New(nil)
params := &cloudwatchlogs.GetLogEventsInput{
LogGroupName: aws.String("LogGroupName"), // Required
LogStreamName: aws.String("LogStreamName"), // Required
EndTime: aws.Long(1),
Limit: aws.Long(1),
NextToken: aws.String("NextToken"),
StartFromHead: aws.Boolean(true),
StartTime: aws.Long(1),
}
resp, err := svc.GetLogEvents(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:32,代码来源:examples_test.go
示例7: ExampleCloudSearch_UpdateScalingParameters
func ExampleCloudSearch_UpdateScalingParameters() {
svc := cloudsearch.New(nil)
params := &cloudsearch.UpdateScalingParametersInput{
DomainName: aws.String("DomainName"), // Required
ScalingParameters: &cloudsearch.ScalingParameters{ // Required
DesiredInstanceType: aws.String("PartitionInstanceType"),
DesiredPartitionCount: aws.Long(1),
DesiredReplicationCount: aws.Long(1),
},
}
resp, err := svc.UpdateScalingParameters(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:31,代码来源:examples_test.go
示例8: ExampleECS_RegisterContainerInstance
func ExampleECS_RegisterContainerInstance() {
svc := ecs.New(nil)
params := &ecs.RegisterContainerInstanceInput{
Cluster: aws.String("String"),
InstanceIdentityDocument: aws.String("String"),
InstanceIdentityDocumentSignature: aws.String("String"),
TotalResources: []*ecs.Resource{
&ecs.Resource{ // Required
DoubleValue: aws.Double(1.0),
IntegerValue: aws.Long(1),
LongValue: aws.Long(1),
Name: aws.String("String"),
StringSetValue: []*string{
aws.String("String"), // Required
// More values...
},
Type: aws.String("String"),
},
// More values...
},
}
resp, err := svc.RegisterContainerInstance(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:rafkhan,项目名称:amazon-ecs-agent,代码行数:35,代码来源:examples_test.go
示例9: ExampleCognitoSync_ListRecords
func ExampleCognitoSync_ListRecords() {
svc := cognitosync.New(nil)
params := &cognitosync.ListRecordsInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityID: aws.String("IdentityId"), // Required
IdentityPoolID: aws.String("IdentityPoolId"), // Required
LastSyncCount: aws.Long(1),
MaxResults: aws.Long(1),
NextToken: aws.String("String"),
SyncSessionToken: aws.String("SyncSessionToken"),
}
resp, err := svc.ListRecords(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:32,代码来源:examples_test.go
示例10: ExampleRoute53_UpdateHealthCheck
func ExampleRoute53_UpdateHealthCheck() {
svc := route53.New(nil)
params := &route53.UpdateHealthCheckInput{
HealthCheckID: aws.String("HealthCheckId"), // Required
FailureThreshold: aws.Long(1),
FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"),
HealthCheckVersion: aws.Long(1),
IPAddress: aws.String("IPAddress"),
Port: aws.Long(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:33,代码来源:examples_test.go
示例11: ExampleRoute53_UpdateHealthCheck
func ExampleRoute53_UpdateHealthCheck() {
svc := route53.New(nil)
params := &route53.UpdateHealthCheckInput{
HealthCheckID: aws.String("HealthCheckId"), // Required
FailureThreshold: aws.Long(1),
FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"),
HealthCheckVersion: aws.Long(1),
IPAddress: aws.String("IPAddress"),
Port: aws.Long(1),
ResourcePath: aws.String("ResourcePath"),
SearchString: aws.String("SearchString"),
}
resp, err := svc.UpdateHealthCheck(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:Dahlgren,项目名称:platform,代码行数:26,代码来源:examples_test.go
示例12: ExampleStorageGateway_UpdateBandwidthRateLimit
func ExampleStorageGateway_UpdateBandwidthRateLimit() {
svc := storagegateway.New(nil)
params := &storagegateway.UpdateBandwidthRateLimitInput{
GatewayARN: aws.String("GatewayARN"), // Required
AverageDownloadRateLimitInBitsPerSec: aws.Long(1),
AverageUploadRateLimitInBitsPerSec: aws.Long(1),
}
resp, err := svc.UpdateBandwidthRateLimit(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:28,代码来源:examples_test.go
示例13: ExampleRoute53_CreateHealthCheck
func ExampleRoute53_CreateHealthCheck() {
svc := route53.New(nil)
params := &route53.CreateHealthCheckInput{
CallerReference: aws.String("HealthCheckNonce"), // Required
HealthCheckConfig: &route53.HealthCheckConfig{ // Required
Type: aws.String("HealthCheckType"), // Required
FailureThreshold: aws.Long(1),
FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"),
IPAddress: aws.String("IPAddress"),
Port: aws.Long(1),
RequestInterval: aws.Long(1),
ResourcePath: aws.String("ResourcePath"),
SearchString: aws.String("SearchString"),
},
}
resp, err := svc.CreateHealthCheck(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:Dahlgren,项目名称:platform,代码行数:29,代码来源:examples_test.go
示例14: ExampleElastiCache_DescribeEvents
func ExampleElastiCache_DescribeEvents() {
svc := elasticache.New(nil)
params := &elasticache.DescribeEventsInput{
Duration: aws.Long(1),
EndTime: aws.Time(time.Now()),
Marker: aws.String("String"),
MaxRecords: aws.Long(1),
SourceIdentifier: aws.String("String"),
SourceType: aws.String("SourceType"),
StartTime: aws.Time(time.Now()),
}
resp, err := svc.DescribeEvents(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:32,代码来源:examples_test.go
示例15: ExampleLambda_CreateFunction
func ExampleLambda_CreateFunction() {
svc := lambda.New(nil)
params := &lambda.CreateFunctionInput{
Code: &lambda.FunctionCode{ // Required
ZipFile: []byte("PAYLOAD"),
},
FunctionName: aws.String("FunctionName"), // Required
Handler: aws.String("Handler"), // Required
Role: aws.String("RoleArn"), // Required
Runtime: aws.String("Runtime"), // Required
Description: aws.String("Description"),
MemorySize: aws.Long(1),
Timeout: aws.Long(1),
}
resp, err := svc.CreateFunction(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:35,代码来源:examples_test.go
示例16: ExampleS3_UploadPart
func ExampleS3_UploadPart() {
svc := s3.New(nil)
params := &s3.UploadPartInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
PartNumber: aws.Long(1), // Required
UploadID: aws.String("MultipartUploadId"), // Required
Body: bytes.NewReader([]byte("PAYLOAD")),
ContentLength: aws.Long(1),
ContentMD5: aws.String("ContentMD5"),
RequestPayer: aws.String("RequestPayer"),
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
}
resp, err := svc.UploadPart(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:experiment,项目名称:front,代码行数:29,代码来源:examples_test.go
示例17: ExampleECS_SubmitContainerStateChange
func ExampleECS_SubmitContainerStateChange() {
svc := ecs.New(nil)
params := &ecs.SubmitContainerStateChangeInput{
Cluster: aws.String("String"),
ContainerName: aws.String("String"),
ExitCode: aws.Long(1),
NetworkBindings: []*ecs.NetworkBinding{
&ecs.NetworkBinding{ // Required
BindIP: aws.String("String"),
ContainerPort: aws.Long(1),
HostPort: aws.Long(1),
},
// More values...
},
Reason: aws.String("String"),
Status: aws.String("String"),
Task: aws.String("String"),
}
resp, err := svc.SubmitContainerStateChange(params)
if awserr := aws.Error(err); awserr != nil {
// A service error occurred.
fmt.Println("Error:", awserr.Code, awserr.Message)
} else if err != nil {
// A non-service error occurred.
panic(err)
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:rafkhan,项目名称:amazon-ecs-agent,代码行数:32,代码来源:examples_test.go
示例18: ExampleDirectConnect_AllocatePrivateVirtualInterface
func ExampleDirectConnect_AllocatePrivateVirtualInterface() {
svc := directconnect.New(nil)
params := &directconnect.AllocatePrivateVirtualInterfaceInput{
ConnectionID: aws.String("ConnectionId"), // Required
NewPrivateVirtualInterfaceAllocation: &directconnect.NewPrivateVirtualInterfaceAllocation{ // Required
ASN: aws.Long(1), // Required
VLAN: aws.Long(1), // Required
VirtualInterfaceName: aws.String("VirtualInterfaceName"), // Required
AmazonAddress: aws.String("AmazonAddress"),
AuthKey: aws.String("BGPAuthKey"),
CustomerAddress: aws.String("CustomerAddress"),
},
OwnerAccount: aws.String("OwnerAccount"), // Required
}
resp, err := svc.AllocatePrivateVirtualInterface(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:ninefive,项目名称:confd,代码行数:35,代码来源:examples_test.go
示例19: ExampleELB_ConfigureHealthCheck
func ExampleELB_ConfigureHealthCheck() {
svc := elb.New(nil)
params := &elb.ConfigureHealthCheckInput{
HealthCheck: &elb.HealthCheck{ // Required
HealthyThreshold: aws.Long(1), // Required
Interval: aws.Long(1), // Required
Target: aws.String("HealthCheckTarget"), // Required
Timeout: aws.Long(1), // Required
UnhealthyThreshold: aws.Long(1), // Required
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.ConfigureHealthCheck(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:33,代码来源:examples_test.go
示例20: ExampleAutoScaling_CreateAutoScalingGroup
func ExampleAutoScaling_CreateAutoScalingGroup() {
svc := autoscaling.New(nil)
params := &autoscaling.CreateAutoScalingGroupInput{
AutoScalingGroupName: aws.String("XmlStringMaxLen255"), // Required
MaxSize: aws.Long(1), // Required
MinSize: aws.Long(1), // Required
AvailabilityZones: []*string{
aws.String("XmlStringMaxLen255"), // Required
// More values...
},
DefaultCooldown: aws.Long(1),
DesiredCapacity: aws.Long(1),
HealthCheckGracePeriod: aws.Long(1),
HealthCheckType: aws.String("XmlStringMaxLen32"),
InstanceID: aws.String("XmlStringMaxLen16"),
LaunchConfigurationName: aws.String("ResourceName"),
LoadBalancerNames: []*string{
aws.String("XmlStringMaxLen255"), // Required
// More values...
},
PlacementGroup: aws.String("XmlStringMaxLen255"),
Tags: []*autoscaling.Tag{
&autoscaling.Tag{ // Required
Key: aws.String("TagKey"), // Required
PropagateAtLaunch: aws.Boolean(true),
ResourceID: aws.String("XmlString"),
ResourceType: aws.String("XmlString"),
Value: aws.String("TagValue"),
},
// More values...
},
TerminationPolicies: []*string{
aws.String("XmlStringMaxLen1600"), // Required
// More values...
},
VPCZoneIdentifier: aws.String("XmlStringMaxLen255"),
}
resp, err := svc.CreateAutoScalingGroup(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 alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:ninefive,项目名称:confd,代码行数:58,代码来源:examples_test.go
注:本文中的github.com/awslabs/aws-sdk-go/aws.Long函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论