当前位置: 首页>>代码示例>>Golang>>正文


Golang CloudFormation.CreateStack方法代码示例

本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/cloudformation.CloudFormation.CreateStack方法的典型用法代码示例。如果您正苦于以下问题:Golang CloudFormation.CreateStack方法的具体用法?Golang CloudFormation.CreateStack怎么用?Golang CloudFormation.CreateStack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/aws/aws-sdk-go/service/cloudformation.CloudFormation的用法示例。


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

示例1: provisionStack

func provisionStack(svc *awscf.CloudFormation, b []byte, onFailure string, params []*awscf.Parameter, stackName string) {
	input := &awscf.CreateStackInput{
		StackName: aws.String(stackName),
		Capabilities: []*string{
			aws.String("CAPABILITY_IAM"),
		},
		OnFailure:        aws.String(onFailure),
		Parameters:       params,
		TemplateBody:     aws.String(string(b)),
		TimeoutInMinutes: aws.Long(20),
	}
	resp, err := svc.CreateStack(input)
	if err != nil {
		log.Fatal(err)
	}

	log.Println(awsutil.StringValue(resp))
}
开发者ID:zeushammer,项目名称:cftool,代码行数:18,代码来源:main.go

示例2: runCreate

func (r *Run) runCreate(client *cf.CloudFormation, d tacks.Document, stack string) error {

	e := d.Environment

	tacks.Logger().Infof("Creating stack %s", e.StackName)

	var (
		capabilities     []*string
		onFailure        = "DO_NOTHING"
		tags             []*cf.Tag
		timeoutInMinutes uint8 = 15
	)

	if d.IsIamCapabilitiesRequired() {
		capabilities = append(capabilities, aws.String("CAPABILITY_IAM"))
	}

	if e.DeleteOnFailure {
		onFailure = "DELETE"
	}

	if e.Timeout > 0 {
		timeoutInMinutes = e.Timeout
	}

	for key, value := range e.Tags {
		tags = append(tags, &cf.Tag{
			Key:   aws.String(key),
			Value: aws.String(value),
		})
	}

	_, err := client.CreateStack(&cf.CreateStackInput{
		Capabilities:     capabilities,
		OnFailure:        aws.String(onFailure),
		StackName:        aws.String(e.StackName),
		Tags:             tags,
		TemplateBody:     aws.String(stack),
		TimeoutInMinutes: aws.Long(int64(timeoutInMinutes)),
	})

	return err

}
开发者ID:inka,项目名称:tacks,代码行数:44,代码来源:run.go

示例3: createStackAndWait

func createStackAndWait(svc *cloudformation.CloudFormation, name, stackBody string) error {
	creq := &cloudformation.CreateStackInput{
		StackName:    aws.String(name),
		OnFailure:    aws.String("DO_NOTHING"),
		Capabilities: []*string{aws.String(cloudformation.CapabilityCapabilityIam)},
		TemplateBody: aws.String(stackBody),
	}

	resp, err := svc.CreateStack(creq)
	if err != nil {
		return err
	}

	if err := waitForStackCreateComplete(svc, aws.StringValue(resp.StackId)); err != nil {
		return err
	}

	return nil
}
开发者ID:colhom,项目名称:coreos-kubernetes,代码行数:19,代码来源:stack.go


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