本文整理匯總了Golang中bosun/org/_third_party/github.com/aws/aws-sdk-go/service/autoscaling.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了New函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExampleAutoScaling_DescribeScheduledActions
func ExampleAutoScaling_DescribeScheduledActions() {
svc := autoscaling.New(nil)
params := &autoscaling.DescribeScheduledActionsInput{
AutoScalingGroupName: aws.String("ResourceName"),
EndTime: aws.Time(time.Now()),
MaxRecords: aws.Int64(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 {
// 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: ExampleAutoScaling_DescribePolicies
func ExampleAutoScaling_DescribePolicies() {
svc := autoscaling.New(nil)
params := &autoscaling.DescribePoliciesInput{
AutoScalingGroupName: aws.String("ResourceName"),
MaxRecords: aws.Int64(1),
NextToken: aws.String("XmlString"),
PolicyNames: []*string{
aws.String("ResourceName"), // Required
// More values...
},
PolicyTypes: []*string{
aws.String("XmlStringMaxLen64"), // Required
// More values...
},
}
resp, err := svc.DescribePolicies(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: ExampleAutoScaling_UpdateAutoScalingGroup
func ExampleAutoScaling_UpdateAutoScalingGroup() {
svc := autoscaling.New(nil)
params := &autoscaling.UpdateAutoScalingGroupInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
AvailabilityZones: []*string{
aws.String("XmlStringMaxLen255"), // Required
// More values...
},
DefaultCooldown: aws.Int64(1),
DesiredCapacity: aws.Int64(1),
HealthCheckGracePeriod: aws.Int64(1),
HealthCheckType: aws.String("XmlStringMaxLen32"),
LaunchConfigurationName: aws.String("ResourceName"),
MaxSize: aws.Int64(1),
MinSize: aws.Int64(1),
PlacementGroup: aws.String("XmlStringMaxLen255"),
TerminationPolicies: []*string{
aws.String("XmlStringMaxLen1600"), // Required
// More values...
},
VPCZoneIdentifier: aws.String("XmlStringMaxLen255"),
}
resp, err := svc.UpdateAutoScalingGroup(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: ExampleAutoScaling_DescribeTags
func ExampleAutoScaling_DescribeTags() {
svc := autoscaling.New(nil)
params := &autoscaling.DescribeTagsInput{
Filters: []*autoscaling.Filter{
{ // Required
Name: aws.String("XmlString"),
Values: []*string{
aws.String("XmlString"), // Required
// More values...
},
},
// More values...
},
MaxRecords: aws.Int64(1),
NextToken: aws.String("XmlString"),
}
resp, err := svc.DescribeTags(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: 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.Int64(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 {
// 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: 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
Cooldown: aws.Int64(1),
EstimatedInstanceWarmup: aws.Int64(1),
MetricAggregationType: aws.String("XmlStringMaxLen32"),
MinAdjustmentMagnitude: aws.Int64(1),
MinAdjustmentStep: aws.Int64(1),
PolicyType: aws.String("XmlStringMaxLen64"),
ScalingAdjustment: aws.Int64(1),
StepAdjustments: []*autoscaling.StepAdjustment{
{ // Required
ScalingAdjustment: aws.Int64(1), // Required
MetricIntervalLowerBound: aws.Float64(1.0),
MetricIntervalUpperBound: aws.Float64(1.0),
},
// More values...
},
}
resp, err := svc.PutScalingPolicy(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: ExampleAutoScaling_DeleteTags
func ExampleAutoScaling_DeleteTags() {
svc := autoscaling.New(nil)
params := &autoscaling.DeleteTagsInput{
Tags: []*autoscaling.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
PropagateAtLaunch: aws.Bool(true),
ResourceId: aws.String("XmlString"),
ResourceType: aws.String("XmlString"),
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.DeleteTags(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: ExampleAutoScaling_PutScheduledUpdateGroupAction
func ExampleAutoScaling_PutScheduledUpdateGroupAction() {
svc := autoscaling.New(nil)
params := &autoscaling.PutScheduledUpdateGroupActionInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
ScheduledActionName: aws.String("XmlStringMaxLen255"), // Required
DesiredCapacity: aws.Int64(1),
EndTime: aws.Time(time.Now()),
MaxSize: aws.Int64(1),
MinSize: aws.Int64(1),
Recurrence: aws.String("XmlStringMaxLen255"),
StartTime: aws.Time(time.Now()),
Time: aws.Time(time.Now()),
}
resp, err := svc.PutScheduledUpdateGroupAction(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)
}
示例9: ExampleAutoScaling_CreateLaunchConfiguration
func ExampleAutoScaling_CreateLaunchConfiguration() {
svc := autoscaling.New(nil)
params := &autoscaling.CreateLaunchConfigurationInput{
LaunchConfigurationName: aws.String("XmlStringMaxLen255"), // Required
AssociatePublicIpAddress: aws.Bool(true),
BlockDeviceMappings: []*autoscaling.BlockDeviceMapping{
{ // Required
DeviceName: aws.String("XmlStringMaxLen255"), // Required
Ebs: &autoscaling.Ebs{
DeleteOnTermination: aws.Bool(true),
Iops: aws.Int64(1),
SnapshotId: aws.String("XmlStringMaxLen255"),
VolumeSize: aws.Int64(1),
VolumeType: aws.String("BlockDeviceEbsVolumeType"),
},
NoDevice: aws.Bool(true),
VirtualName: aws.String("XmlStringMaxLen255"),
},
// More values...
},
ClassicLinkVPCId: aws.String("XmlStringMaxLen255"),
ClassicLinkVPCSecurityGroups: []*string{
aws.String("XmlStringMaxLen255"), // Required
// More values...
},
EbsOptimized: aws.Bool(true),
IamInstanceProfile: aws.String("XmlStringMaxLen1600"),
ImageId: aws.String("XmlStringMaxLen255"),
InstanceId: aws.String("XmlStringMaxLen16"),
InstanceMonitoring: &autoscaling.InstanceMonitoring{
Enabled: aws.Bool(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 {
// 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)
}
示例10: c_aws
func c_aws(accessKey, secretKey, region string) (opentsdb.MultiDataPoint, error) {
var md opentsdb.MultiDataPoint
creds := credentials.NewStaticCredentials(accessKey, secretKey, "")
conf := &aws.Config{
Credentials: creds,
Region: ®ion,
}
ecc := ec2.New(conf)
if ecc == nil {
return nil, fmt.Errorf("unable to login to EC2")
}
as := autoscaling.New(conf)
if as == nil {
return nil, fmt.Errorf("unable to login to AutoScaling")
}
elb := elb.New(conf)
if elb == nil {
return nil, fmt.Errorf("unable to login to ELB")
}
cw := cloudwatch.New(conf)
if cw == nil {
return nil, fmt.Errorf("unable to login to CloudWatch")
}
instances, err := awsGetInstances(*ecc)
if err != nil {
slog.Info("No EC2 Instances found.")
}
loadBalancers, err := awsGetLoadBalancers(*elb)
if err != nil {
slog.Info("No ELB Load Balancecrs found.")
}
asgs, err := awsGetAutoScaleGroups(*as)
if err != nil {
slog.Info("No AutoScaleGroups found.")
}
for _, loadBalancer := range loadBalancers {
awsGetELBLatency(*cw, &md, loadBalancer)
awsGetELBHostCounts(*cw, &md, loadBalancer)
awsGetELB2XX(*cw, &md, loadBalancer)
awsGetELB5XX(*cw, &md, loadBalancer)
}
for _, instance := range instances {
awsGetCPU(*cw, &md, instance)
awsGetNetwork(*cw, &md, instance)
awsGetDiskBytes(*cw, &md, instance)
awsGetDiskOps(*cw, &md, instance)
awsGetStatusChecks(*cw, &md, instance)
}
for _, asg := range asgs {
awsGetAsgCPU(*cw, &md, asg)
}
return md, nil
}
示例11: ExampleAutoScaling_DescribeTerminationPolicyTypes
func ExampleAutoScaling_DescribeTerminationPolicyTypes() {
svc := autoscaling.New(nil)
var params *autoscaling.DescribeTerminationPolicyTypesInput
resp, err := svc.DescribeTerminationPolicyTypes(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: ExampleAutoScaling_DeleteLaunchConfiguration
func ExampleAutoScaling_DeleteLaunchConfiguration() {
svc := autoscaling.New(nil)
params := &autoscaling.DeleteLaunchConfigurationInput{
LaunchConfigurationName: aws.String("ResourceName"), // Required
}
resp, err := svc.DeleteLaunchConfiguration(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: ExampleAutoScaling_TerminateInstanceInAutoScalingGroup
func ExampleAutoScaling_TerminateInstanceInAutoScalingGroup() {
svc := autoscaling.New(nil)
params := &autoscaling.TerminateInstanceInAutoScalingGroupInput{
InstanceId: aws.String("XmlStringMaxLen16"), // Required
ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
}
resp, err := svc.TerminateInstanceInAutoScalingGroup(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: ExampleAutoScaling_DeleteAutoScalingGroup
func ExampleAutoScaling_DeleteAutoScalingGroup() {
svc := autoscaling.New(nil)
params := &autoscaling.DeleteAutoScalingGroupInput{
AutoScalingGroupName: aws.String("ResourceName"), // Required
ForceDelete: aws.Bool(true),
}
resp, err := svc.DeleteAutoScalingGroup(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)
}
示例15: 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 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)
}