本文整理汇总了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))
}
示例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
}
示例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
}