本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/service/autoscaling.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleAutoScaling_EnableMetricsCollection
func ExampleAutoScaling_EnableMetricsCollection() {
svc := autoscaling.New(nil)
params := &autoscaling.EnableMetricsCollectionInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
Granularity: aws.String("XmlStringMaxLen255"), // Required
Metrics: []*string{
aws.String("XmlStringMaxLen255"), // Required
// More values...
},
}
resp, err := svc.EnableMetricsCollection(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: ExampleAutoScaling_DeleteTags
func ExampleAutoScaling_DeleteTags() {
svc := autoscaling.New(nil)
params := &autoscaling.DeleteTagsInput{
Tags: []*autoscaling.Tag{ // Required
&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...
},
}
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 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
示例3: ExampleAutoScaling_DetachInstances
func ExampleAutoScaling_DetachInstances() {
svc := autoscaling.New(nil)
params := &autoscaling.DetachInstancesInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
ShouldDecrementDesiredCapacity: aws.Boolean(true), // Required
InstanceIDs: []*string{
aws.String("XmlStringMaxLen16"), // Required
// More values...
},
}
resp, err := svc.DetachInstances(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
示例4: ExampleAutoScaling_DescribeScheduledActions
func ExampleAutoScaling_DescribeScheduledActions() {
svc := autoscaling.New(nil)
params := &autoscaling.DescribeScheduledActionsInput{
AutoScalingGroupName: aws.String("ResourceName"),
EndTime: aws.Time(time.Now()),
MaxRecords: aws.Long(1),
NextToken: aws.String("XmlString"),
ScheduledActionNames: []*string{
aws.String("ResourceName"), // Required
// More values...
},
StartTime: aws.Time(time.Now()),
}
resp, err := svc.DescribeScheduledActions(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
示例5: ExampleAutoScaling_CompleteLifecycleAction
func ExampleAutoScaling_CompleteLifecycleAction() {
svc := autoscaling.New(nil)
params := &autoscaling.CompleteLifecycleActionInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
LifecycleActionResult: aws.String("LifecycleActionResult"), // Required
LifecycleActionToken: aws.String("LifecycleActionToken"), // Required
LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
}
resp, err := svc.CompleteLifecycleAction(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,代码行数:29,代码来源:examples_test.go
示例6: ExampleAutoScaling_SetInstanceHealth
func ExampleAutoScaling_SetInstanceHealth() {
svc := autoscaling.New(nil)
params := &autoscaling.SetInstanceHealthInput{
HealthStatus: aws.String("XmlStringMaxLen32"), // Required
InstanceID: aws.String("XmlStringMaxLen16"), // Required
ShouldRespectGracePeriod: aws.Boolean(true),
}
resp, err := svc.SetInstanceHealth(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,代码行数:28,代码来源:examples_test.go
示例7: ExampleAutoScaling_SetDesiredCapacity
func ExampleAutoScaling_SetDesiredCapacity() {
svc := autoscaling.New(nil)
params := &autoscaling.SetDesiredCapacityInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
DesiredCapacity: aws.Long(1), // Required
HonorCooldown: aws.Boolean(true),
}
resp, err := svc.SetDesiredCapacity(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,代码行数:28,代码来源:examples_test.go
示例8: 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
示例9: 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
示例10: ExampleAutoScaling_PutLifecycleHook
func ExampleAutoScaling_PutLifecycleHook() {
svc := autoscaling.New(nil)
params := &autoscaling.PutLifecycleHookInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
DefaultResult: aws.String("LifecycleActionResult"),
HeartbeatTimeout: aws.Long(1),
LifecycleTransition: aws.String("LifecycleTransition"),
NotificationMetadata: aws.String("XmlStringMaxLen1023"),
NotificationTargetARN: aws.String("ResourceName"),
RoleARN: aws.String("ResourceName"),
}
resp, err := svc.PutLifecycleHook(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,代码行数:33,代码来源:examples_test.go
示例11: 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
示例12: ExampleAutoScaling_DescribeTerminationPolicyTypes
func ExampleAutoScaling_DescribeTerminationPolicyTypes() {
svc := autoscaling.New(nil)
var params *autoscaling.DescribeTerminationPolicyTypesInput
resp, err := svc.DescribeTerminationPolicyTypes(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,代码行数:24,代码来源:examples_test.go
示例13: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*autoscalingiface.AutoScalingAPI)(nil), autoscaling.New(nil))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:3,代码来源:interface_test.go
示例14: ExampleAutoScaling_CreateLaunchConfiguration
func ExampleAutoScaling_CreateLaunchConfiguration() {
svc := autoscaling.New(nil)
params := &autoscaling.CreateLaunchConfigurationInput{
LaunchConfigurationName: aws.String("XmlStringMaxLen255"), // Required
AssociatePublicIPAddress: aws.Boolean(true),
BlockDeviceMappings: []*autoscaling.BlockDeviceMapping{
&autoscaling.BlockDeviceMapping{ // Required
DeviceName: aws.String("XmlStringMaxLen255"), // Required
EBS: &autoscaling.EBS{
DeleteOnTermination: aws.Boolean(true),
IOPS: aws.Long(1),
SnapshotID: aws.String("XmlStringMaxLen255"),
VolumeSize: aws.Long(1),
VolumeType: aws.String("BlockDeviceEbsVolumeType"),
},
NoDevice: aws.Boolean(true),
VirtualName: aws.String("XmlStringMaxLen255"),
},
// More values...
},
ClassicLinkVPCID: aws.String("XmlStringMaxLen255"),
ClassicLinkVPCSecurityGroups: []*string{
aws.String("XmlStringMaxLen255"), // Required
// More values...
},
EBSOptimized: aws.Boolean(true),
IAMInstanceProfile: aws.String("XmlStringMaxLen1600"),
ImageID: aws.String("XmlStringMaxLen255"),
InstanceID: aws.String("XmlStringMaxLen16"),
InstanceMonitoring: &autoscaling.InstanceMonitoring{
Enabled: aws.Boolean(true),
},
InstanceType: aws.String("XmlStringMaxLen255"),
KernelID: aws.String("XmlStringMaxLen255"),
KeyName: aws.String("XmlStringMaxLen255"),
PlacementTenancy: aws.String("XmlStringMaxLen64"),
RAMDiskID: aws.String("XmlStringMaxLen255"),
SecurityGroups: []*string{
aws.String("XmlString"), // Required
// More values...
},
SpotPrice: aws.String("SpotPrice"),
UserData: aws.String("XmlStringUserData"),
}
resp, err := svc.CreateLaunchConfiguration(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,代码行数:65,代码来源:examples_test.go
示例15: init
func init() {
Before("@autoscaling", func() {
World["client"] = autoscaling.New(nil)
})
}
开发者ID:ninefive,项目名称:confd,代码行数:5,代码来源:client.go
注:本文中的github.com/awslabs/aws-sdk-go/service/autoscaling.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论