• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang autoscaling.New函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/autoscaling.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了New函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: ExampleAutoScaling_DetachInstances

func ExampleAutoScaling_DetachInstances() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := autoscaling.New(sess)

	params := &autoscaling.DetachInstancesInput{
		AutoScalingGroupName:           aws.String("ResourceName"), // Required
		ShouldDecrementDesiredCapacity: aws.Bool(true),             // Required
		InstanceIds: []*string{
			aws.String("XmlStringMaxLen19"), // Required
			// More values...
		},
	}
	resp, err := svc.DetachInstances(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:29,代码来源:examples_test.go


示例2: ExampleAutoScaling_PutLifecycleHook

func ExampleAutoScaling_PutLifecycleHook() {
	svc := autoscaling.New(session.New())

	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)
}
开发者ID:lucmichalski,项目名称:s3secrets,代码行数:25,代码来源:examples_test.go


示例3: ExampleAutoScaling_PutScheduledUpdateGroupAction

func ExampleAutoScaling_PutScheduledUpdateGroupAction() {
	svc := autoscaling.New(session.New())

	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)
}
开发者ID:lucmichalski,项目名称:s3secrets,代码行数:26,代码来源:examples_test.go


示例4: ExampleAutoScaling_UpdateAutoScalingGroup

func ExampleAutoScaling_UpdateAutoScalingGroup() {
	svc := autoscaling.New(session.New())

	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)
}
开发者ID:lucmichalski,项目名称:s3secrets,代码行数:35,代码来源:examples_test.go


示例5: ExampleAutoScaling_DescribeScheduledActions

func ExampleAutoScaling_DescribeScheduledActions() {
	svc := autoscaling.New(session.New())

	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)
}
开发者ID:lucmichalski,项目名称:s3secrets,代码行数:26,代码来源:examples_test.go


示例6: 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 always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go


示例7: deleteAutoScaleGroups

// Private function without the confirmation terminal prompts
func deleteAutoScaleGroups(asgList *AutoScaleGroups, force, dryRun bool) (err error) {
	for _, asg := range *asgList {
		svc := autoscaling.New(session.New(&aws.Config{Region: aws.String(asg.Region)}))

		params := &autoscaling.DeleteAutoScalingGroupInput{
			AutoScalingGroupName: aws.String(asg.Name),
			ForceDelete:          aws.Bool(force),
		}

		// Delete it!
		if !dryRun {
			_, err := svc.DeleteAutoScalingGroup(params)
			if err != nil {
				if awsErr, ok := err.(awserr.Error); ok {
					return errors.New(awsErr.Message())
				}
				return err
			}

			terminal.Information("Deleted AutoScaling Group [" + asg.Name + "] in [" + asg.Region + "]!")

		} else {
			fmt.Println(params)
		}

	}

	return nil
}
开发者ID:murdinc,项目名称:awsm,代码行数:30,代码来源:autoscalegroups.go


示例8: getAutoScalingInstances

// Returns all instances that are in autoscaling groups within the given region
// if a autoscaling group name is specified then only the instances within that group are returned
func getAutoScalingInstances() []*autoscaling.InstanceDetails {
	instances := make([]*autoscaling.InstanceDetails, 0, 50)
	var token *string
	var resp *autoscaling.DescribeAutoScalingInstancesOutput
	var err error

	svc := autoscaling.New(session.New(), &aws.Config{Region: aws.String(flag_region)})

	// DescribeAutoscalinginstances() only returns 50 instances a time so...
	// keep calling for more until all have been retrieved
	for {

		params := &autoscaling.DescribeAutoScalingInstancesInput{
			NextToken: token,
		}
		resp, err = svc.DescribeAutoScalingInstances(params)
		if err != nil {
			fmt.Println(err.Error())
			return nil
		}
		instances = append(instances, resp.AutoScalingInstances...)
		token = resp.NextToken

		// no more instances to get. We done hehr
		if token == nil {
			break
		}
	}
	if flag_asgName == "" {
		return instances
	}
	return filterByASGName(instances)
}
开发者ID:tskinn,项目名称:ASGInstancesByAge,代码行数:35,代码来源:ASGInstancesByAge.go


示例9: 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)
}
开发者ID:jloper3,项目名称:amazon-ecs-cli,代码行数:28,代码来源:examples_test.go


示例10: main

func main() {
	kingpin.Parse()

	me := ec2metadata.New(session.New(), &aws.Config{})
	region, err := me.Region()
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	cw := cloudwatch.New(session.New(&aws.Config{Region: aws.String(region)}))
	as := autoscaling.New(session.New(&aws.Config{Region: aws.String(region)}))

	// Get the name of this instance.
	instance, err := me.GetMetadata("instance-id")
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	log.Printf("Instance: %s", instance)

	// Check if this instance is in an auto scaling group.
	gps, err := as.DescribeAutoScalingInstances(&autoscaling.DescribeAutoScalingInstancesInput{
		InstanceIds: []*string{
			aws.String(instance),
		},
	})
	if err == nil && len(gps.AutoScalingInstances) > 0 {
		group = *gps.AutoScalingInstances[0].AutoScalingGroupName
		log.Printf("AutoScaling group: %s", group)
	}

	// Loop and send to the backend.
	limiter := time.Tick(time.Second * 60)
	for {
		<-limiter

		// Submit all the values.
		for _, mn := range strings.Split(*cliMetrics, ",") {
			m, err := metric.New(mn)
			if err != nil {
				log.Printf("Cannot find metric: %s" + mn)
				continue
			}

			v, err := m.Value()
			if err != nil {
				log.Println("Cannot get metric.")
			}

			// Send the instance metrics.
			Send(cw, "InstanceId", instance, m.Name(), v)

			// Send the autoscaling.
			if group != "" {
				Send(cw, "AutoScalingGroupName", group, m.Name(), v)
			}
		}
	}
}
开发者ID:nickschuch,项目名称:metrics,代码行数:60,代码来源:main.go


示例11: ExampleAutoScaling_DescribeAutoScalingInstances

func ExampleAutoScaling_DescribeAutoScalingInstances() {
	svc := autoscaling.New(nil)

	params := &autoscaling.DescribeAutoScalingInstancesInput{
		InstanceIDs: []*string{
			aws.String("XmlStringMaxLen16"), // Required
			// More values...
		},
		MaxRecords: aws.Long(1),
		NextToken:  aws.String("XmlString"),
	}
	resp, err := svc.DescribeAutoScalingInstances(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:EricMountain-1A,项目名称:openshift-origin,代码行数:31,代码来源:examples_test.go


示例12: ExampleAutoScaling_DeleteScheduledAction

func ExampleAutoScaling_DeleteScheduledAction() {
	svc := autoscaling.New(nil)

	params := &autoscaling.DeleteScheduledActionInput{
		ScheduledActionName:  aws.String("ResourceName"), // Required
		AutoScalingGroupName: aws.String("ResourceName"),
	}
	resp, err := svc.DeleteScheduledAction(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:EricMountain-1A,项目名称:openshift-origin,代码行数:27,代码来源:examples_test.go


示例13: GetLaunchConfigurationsByName

// GetLaunchConfigurationsByName returns a slice of Launch Configurations for a given region and name
func GetLaunchConfigurationsByName(region, name string) (LaunchConfigs, error) {

	svc := autoscaling.New(session.New(&aws.Config{Region: aws.String(region)}))
	params := &autoscaling.DescribeLaunchConfigurationsInput{
		LaunchConfigurationNames: []*string{
			aws.String(name),
		},
	}
	result, err := svc.DescribeLaunchConfigurations(params)
	if err != nil || len(result.LaunchConfigurations) == 0 {
		return LaunchConfigs{}, err
	}

	secGrpList := new(SecurityGroups)
	err = GetRegionSecurityGroups(region, secGrpList, "")

	imgList := new(Images)
	GetRegionImages(region, imgList, "", false)

	lcList := make(LaunchConfigs, len(result.LaunchConfigurations))
	for i, config := range result.LaunchConfigurations {
		lcList[i].Marshal(config, region, secGrpList, imgList)
	}

	if len(lcList) == 0 {
		return lcList, errors.New("No Launch Configurations found with name of [" + name + "] in [" + region + "].")
	}

	return lcList, err
}
开发者ID:murdinc,项目名称:awsm,代码行数:31,代码来源:launchconfigurations.go


示例14: 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 always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:29,代码来源:examples_test.go


示例15: 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 always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:33,代码来源:examples_test.go


示例16: 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 always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:34,代码来源:examples_test.go


示例17: ExampleAutoScaling_PutNotificationConfiguration

func ExampleAutoScaling_PutNotificationConfiguration() {
	svc := autoscaling.New(nil)

	params := &autoscaling.PutNotificationConfigurationInput{
		AutoScalingGroupName: aws.String("ResourceName"), // Required
		NotificationTypes: []*string{ // Required
			aws.String("XmlStringMaxLen255"), // Required
			// More values...
		},
		TopicARN: aws.String("ResourceName"), // Required
	}
	resp, err := svc.PutNotificationConfiguration(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 always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go


示例18: LifecycleEventQueueURL

// LifecycleEventQueueURL inspects the current autoscaling group and returns
// the URL of the first suitable lifecycle hook queue.
func (s *Cluster) LifecycleEventQueueURL() (string, error) {
	asg, err := s.AutoscalingGroup()
	if err != nil {
		return "", err
	}

	autoscalingSvc := autoscaling.New(s.AwsSession)
	resp, err := autoscalingSvc.DescribeLifecycleHooks(&autoscaling.DescribeLifecycleHooksInput{
		AutoScalingGroupName: asg.AutoScalingGroupName,
	})
	if err != nil {
		return "", err
	}

	sqsSvc := sqs.New(s.AwsSession)
	for _, hook := range resp.LifecycleHooks {
		if !strings.HasPrefix(*hook.NotificationTargetARN, "arn:aws:sqs:") {
			continue
		}
		arnParts := strings.Split(*hook.NotificationTargetARN, ":")
		queueName := arnParts[len(arnParts)-1]
		queueOwnerAWSAccountID := arnParts[len(arnParts)-2]

		resp, err := sqsSvc.GetQueueUrl(&sqs.GetQueueUrlInput{
			QueueName:              &queueName,
			QueueOwnerAWSAccountId: &queueOwnerAWSAccountID,
		})
		if err != nil {
			return "", err
		}
		return *resp.QueueUrl, nil
	}
	return "", ErrLifecycleHookNotFound
}
开发者ID:crewjam,项目名称:ec2cluster,代码行数:36,代码来源:lifecycle.go


示例19: 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.Long(1),
		MinAdjustmentStep:    aws.Long(1),
		ScalingAdjustment:    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 always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
开发者ID:jasonmoo,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go


示例20: CreateAwsManager

// CreateAwsManager constructs awsManager object.
func CreateAwsManager(configReader io.Reader) (*AwsManager, error) {
	if configReader != nil {
		var cfg provider_aws.AWSCloudConfig
		if err := gcfg.ReadInto(&cfg, configReader); err != nil {
			glog.Errorf("Couldn't read config: %v", err)
			return nil, err
		}
	}

	service := autoscaling.New(session.New())
	manager := &AwsManager{
		asgs:     make([]*asgInformation, 0),
		service:  service,
		asgCache: make(map[AwsRef]*Asg),
	}

	go wait.Forever(func() {
		manager.cacheMutex.Lock()
		defer manager.cacheMutex.Unlock()
		if err := manager.regenerateCache(); err != nil {
			glog.Errorf("Error while regenerating Asg cache: %v", err)
		}
	}, time.Hour)

	return manager, nil
}
开发者ID:erikh,项目名称:contrib,代码行数:27,代码来源:aws_manager.go



注:本文中的github.com/aws/aws-sdk-go/service/autoscaling.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang autoscaling.AutoScaling类代码示例发布时间:2022-05-24
下一篇:
Golang applicationautoscaling.New函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap