本文整理汇总了Golang中github.com/datacratic/aws-sdk-go/service/autoscaling.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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 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))
}
示例2: 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 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))
}
示例3: 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 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))
}
示例4: 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 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))
}
示例5: ExampleAutoScaling_DescribeTags
func ExampleAutoScaling_DescribeTags() {
svc := autoscaling.New(nil)
params := &autoscaling.DescribeTagsInput{
Filters: []*autoscaling.Filter{
&autoscaling.Filter{ // Required
Name: aws.String("XmlString"),
Values: []*string{
aws.String("XmlString"), // Required
// More values...
},
},
// More values...
},
MaxRecords: aws.Long(1),
NextToken: aws.String("XmlString"),
}
resp, err := svc.DescribeTags(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))
}
示例6: 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 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))
}
示例7: TestMakingABasicRequest
func TestMakingABasicRequest(t *testing.T) {
client := autoscaling.New(nil)
resp, e := client.DescribeScalingProcessTypes(&autoscaling.DescribeScalingProcessTypesInput{})
err := aws.Error(e)
_, _, _ = resp, e, err // avoid unused warnings
assert.NoError(t, nil, err)
}
示例8: 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 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))
}
示例9: TestErrorHandling
func TestErrorHandling(t *testing.T) {
client := autoscaling.New(nil)
resp, e := client.CreateLaunchConfiguration(&autoscaling.CreateLaunchConfigurationInput{
ImageID: aws.String("ami-12345678"),
InstanceType: aws.String("m1.small"),
LaunchConfigurationName: aws.String(""),
})
err := aws.Error(e)
_, _, _ = resp, e, err // avoid unused warnings
assert.NotEqual(t, nil, err)
assert.Equal(t, "ValidationError", err.Code)
utilassert.Match(t, "Member must have length greater than or equal to 1", err.Message)
}
示例10: ExampleAutoScaling_DescribeTerminationPolicyTypes
func ExampleAutoScaling_DescribeTerminationPolicyTypes() {
svc := autoscaling.New(nil)
var params *autoscaling.DescribeTerminationPolicyTypesInput
resp, err := svc.DescribeTerminationPolicyTypes(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))
}
示例11: ExampleAutoScaling_DeleteLaunchConfiguration
func ExampleAutoScaling_DeleteLaunchConfiguration() {
svc := autoscaling.New(nil)
params := &autoscaling.DeleteLaunchConfigurationInput{
LaunchConfigurationName: aws.String("ResourceName"), // Required
}
resp, err := svc.DeleteLaunchConfiguration(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))
}
示例12: ExampleAutoScaling_TerminateInstanceInAutoScalingGroup
func ExampleAutoScaling_TerminateInstanceInAutoScalingGroup() {
svc := autoscaling.New(nil)
params := &autoscaling.TerminateInstanceInAutoScalingGroupInput{
InstanceID: aws.String("XmlStringMaxLen16"), // Required
ShouldDecrementDesiredCapacity: aws.Boolean(true), // Required
}
resp, err := svc.TerminateInstanceInAutoScalingGroup(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))
}
示例13: ExampleAutoScaling_DeleteAutoScalingGroup
func ExampleAutoScaling_DeleteAutoScalingGroup() {
svc := autoscaling.New(nil)
params := &autoscaling.DeleteAutoScalingGroupInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
ForceDelete: aws.Boolean(true),
}
resp, err := svc.DeleteAutoScalingGroup(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))
}
示例14: ExampleAutoScaling_DeleteLifecycleHook
func ExampleAutoScaling_DeleteLifecycleHook() {
svc := autoscaling.New(nil)
params := &autoscaling.DeleteLifecycleHookInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
}
resp, err := svc.DeleteLifecycleHook(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))
}
示例15: 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 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))
}