Conver to regular Go vendor + dep tool

This commit is contained in:
Andrey Smirnov
2017-03-22 17:38:32 +03:00
parent 070347295e
commit c6c1012330
3260 changed files with 1742550 additions and 72 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,192 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudformationiface provides an interface to enable mocking the AWS CloudFormation service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package cloudformationiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudformation"
)
// CloudFormationAPI provides an interface to enable mocking the
// cloudformation.CloudFormation service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // AWS CloudFormation.
// func myFunc(svc cloudformationiface.CloudFormationAPI) bool {
// // Make svc.CancelUpdateStack request
// }
//
// func main() {
// sess := session.New()
// svc := cloudformation.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockCloudFormationClient struct {
// cloudformationiface.CloudFormationAPI
// }
// func (m *mockCloudFormationClient) CancelUpdateStack(input *cloudformation.CancelUpdateStackInput) (*cloudformation.CancelUpdateStackOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockCloudFormationClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type CloudFormationAPI interface {
CancelUpdateStack(*cloudformation.CancelUpdateStackInput) (*cloudformation.CancelUpdateStackOutput, error)
CancelUpdateStackWithContext(aws.Context, *cloudformation.CancelUpdateStackInput, ...request.Option) (*cloudformation.CancelUpdateStackOutput, error)
CancelUpdateStackRequest(*cloudformation.CancelUpdateStackInput) (*request.Request, *cloudformation.CancelUpdateStackOutput)
ContinueUpdateRollback(*cloudformation.ContinueUpdateRollbackInput) (*cloudformation.ContinueUpdateRollbackOutput, error)
ContinueUpdateRollbackWithContext(aws.Context, *cloudformation.ContinueUpdateRollbackInput, ...request.Option) (*cloudformation.ContinueUpdateRollbackOutput, error)
ContinueUpdateRollbackRequest(*cloudformation.ContinueUpdateRollbackInput) (*request.Request, *cloudformation.ContinueUpdateRollbackOutput)
CreateChangeSet(*cloudformation.CreateChangeSetInput) (*cloudformation.CreateChangeSetOutput, error)
CreateChangeSetWithContext(aws.Context, *cloudformation.CreateChangeSetInput, ...request.Option) (*cloudformation.CreateChangeSetOutput, error)
CreateChangeSetRequest(*cloudformation.CreateChangeSetInput) (*request.Request, *cloudformation.CreateChangeSetOutput)
CreateStack(*cloudformation.CreateStackInput) (*cloudformation.CreateStackOutput, error)
CreateStackWithContext(aws.Context, *cloudformation.CreateStackInput, ...request.Option) (*cloudformation.CreateStackOutput, error)
CreateStackRequest(*cloudformation.CreateStackInput) (*request.Request, *cloudformation.CreateStackOutput)
DeleteChangeSet(*cloudformation.DeleteChangeSetInput) (*cloudformation.DeleteChangeSetOutput, error)
DeleteChangeSetWithContext(aws.Context, *cloudformation.DeleteChangeSetInput, ...request.Option) (*cloudformation.DeleteChangeSetOutput, error)
DeleteChangeSetRequest(*cloudformation.DeleteChangeSetInput) (*request.Request, *cloudformation.DeleteChangeSetOutput)
DeleteStack(*cloudformation.DeleteStackInput) (*cloudformation.DeleteStackOutput, error)
DeleteStackWithContext(aws.Context, *cloudformation.DeleteStackInput, ...request.Option) (*cloudformation.DeleteStackOutput, error)
DeleteStackRequest(*cloudformation.DeleteStackInput) (*request.Request, *cloudformation.DeleteStackOutput)
DescribeAccountLimits(*cloudformation.DescribeAccountLimitsInput) (*cloudformation.DescribeAccountLimitsOutput, error)
DescribeAccountLimitsWithContext(aws.Context, *cloudformation.DescribeAccountLimitsInput, ...request.Option) (*cloudformation.DescribeAccountLimitsOutput, error)
DescribeAccountLimitsRequest(*cloudformation.DescribeAccountLimitsInput) (*request.Request, *cloudformation.DescribeAccountLimitsOutput)
DescribeChangeSet(*cloudformation.DescribeChangeSetInput) (*cloudformation.DescribeChangeSetOutput, error)
DescribeChangeSetWithContext(aws.Context, *cloudformation.DescribeChangeSetInput, ...request.Option) (*cloudformation.DescribeChangeSetOutput, error)
DescribeChangeSetRequest(*cloudformation.DescribeChangeSetInput) (*request.Request, *cloudformation.DescribeChangeSetOutput)
DescribeStackEvents(*cloudformation.DescribeStackEventsInput) (*cloudformation.DescribeStackEventsOutput, error)
DescribeStackEventsWithContext(aws.Context, *cloudformation.DescribeStackEventsInput, ...request.Option) (*cloudformation.DescribeStackEventsOutput, error)
DescribeStackEventsRequest(*cloudformation.DescribeStackEventsInput) (*request.Request, *cloudformation.DescribeStackEventsOutput)
DescribeStackEventsPages(*cloudformation.DescribeStackEventsInput, func(*cloudformation.DescribeStackEventsOutput, bool) bool) error
DescribeStackEventsPagesWithContext(aws.Context, *cloudformation.DescribeStackEventsInput, func(*cloudformation.DescribeStackEventsOutput, bool) bool, ...request.Option) error
DescribeStackResource(*cloudformation.DescribeStackResourceInput) (*cloudformation.DescribeStackResourceOutput, error)
DescribeStackResourceWithContext(aws.Context, *cloudformation.DescribeStackResourceInput, ...request.Option) (*cloudformation.DescribeStackResourceOutput, error)
DescribeStackResourceRequest(*cloudformation.DescribeStackResourceInput) (*request.Request, *cloudformation.DescribeStackResourceOutput)
DescribeStackResources(*cloudformation.DescribeStackResourcesInput) (*cloudformation.DescribeStackResourcesOutput, error)
DescribeStackResourcesWithContext(aws.Context, *cloudformation.DescribeStackResourcesInput, ...request.Option) (*cloudformation.DescribeStackResourcesOutput, error)
DescribeStackResourcesRequest(*cloudformation.DescribeStackResourcesInput) (*request.Request, *cloudformation.DescribeStackResourcesOutput)
DescribeStacks(*cloudformation.DescribeStacksInput) (*cloudformation.DescribeStacksOutput, error)
DescribeStacksWithContext(aws.Context, *cloudformation.DescribeStacksInput, ...request.Option) (*cloudformation.DescribeStacksOutput, error)
DescribeStacksRequest(*cloudformation.DescribeStacksInput) (*request.Request, *cloudformation.DescribeStacksOutput)
DescribeStacksPages(*cloudformation.DescribeStacksInput, func(*cloudformation.DescribeStacksOutput, bool) bool) error
DescribeStacksPagesWithContext(aws.Context, *cloudformation.DescribeStacksInput, func(*cloudformation.DescribeStacksOutput, bool) bool, ...request.Option) error
EstimateTemplateCost(*cloudformation.EstimateTemplateCostInput) (*cloudformation.EstimateTemplateCostOutput, error)
EstimateTemplateCostWithContext(aws.Context, *cloudformation.EstimateTemplateCostInput, ...request.Option) (*cloudformation.EstimateTemplateCostOutput, error)
EstimateTemplateCostRequest(*cloudformation.EstimateTemplateCostInput) (*request.Request, *cloudformation.EstimateTemplateCostOutput)
ExecuteChangeSet(*cloudformation.ExecuteChangeSetInput) (*cloudformation.ExecuteChangeSetOutput, error)
ExecuteChangeSetWithContext(aws.Context, *cloudformation.ExecuteChangeSetInput, ...request.Option) (*cloudformation.ExecuteChangeSetOutput, error)
ExecuteChangeSetRequest(*cloudformation.ExecuteChangeSetInput) (*request.Request, *cloudformation.ExecuteChangeSetOutput)
GetStackPolicy(*cloudformation.GetStackPolicyInput) (*cloudformation.GetStackPolicyOutput, error)
GetStackPolicyWithContext(aws.Context, *cloudformation.GetStackPolicyInput, ...request.Option) (*cloudformation.GetStackPolicyOutput, error)
GetStackPolicyRequest(*cloudformation.GetStackPolicyInput) (*request.Request, *cloudformation.GetStackPolicyOutput)
GetTemplate(*cloudformation.GetTemplateInput) (*cloudformation.GetTemplateOutput, error)
GetTemplateWithContext(aws.Context, *cloudformation.GetTemplateInput, ...request.Option) (*cloudformation.GetTemplateOutput, error)
GetTemplateRequest(*cloudformation.GetTemplateInput) (*request.Request, *cloudformation.GetTemplateOutput)
GetTemplateSummary(*cloudformation.GetTemplateSummaryInput) (*cloudformation.GetTemplateSummaryOutput, error)
GetTemplateSummaryWithContext(aws.Context, *cloudformation.GetTemplateSummaryInput, ...request.Option) (*cloudformation.GetTemplateSummaryOutput, error)
GetTemplateSummaryRequest(*cloudformation.GetTemplateSummaryInput) (*request.Request, *cloudformation.GetTemplateSummaryOutput)
ListChangeSets(*cloudformation.ListChangeSetsInput) (*cloudformation.ListChangeSetsOutput, error)
ListChangeSetsWithContext(aws.Context, *cloudformation.ListChangeSetsInput, ...request.Option) (*cloudformation.ListChangeSetsOutput, error)
ListChangeSetsRequest(*cloudformation.ListChangeSetsInput) (*request.Request, *cloudformation.ListChangeSetsOutput)
ListExports(*cloudformation.ListExportsInput) (*cloudformation.ListExportsOutput, error)
ListExportsWithContext(aws.Context, *cloudformation.ListExportsInput, ...request.Option) (*cloudformation.ListExportsOutput, error)
ListExportsRequest(*cloudformation.ListExportsInput) (*request.Request, *cloudformation.ListExportsOutput)
ListImports(*cloudformation.ListImportsInput) (*cloudformation.ListImportsOutput, error)
ListImportsWithContext(aws.Context, *cloudformation.ListImportsInput, ...request.Option) (*cloudformation.ListImportsOutput, error)
ListImportsRequest(*cloudformation.ListImportsInput) (*request.Request, *cloudformation.ListImportsOutput)
ListStackResources(*cloudformation.ListStackResourcesInput) (*cloudformation.ListStackResourcesOutput, error)
ListStackResourcesWithContext(aws.Context, *cloudformation.ListStackResourcesInput, ...request.Option) (*cloudformation.ListStackResourcesOutput, error)
ListStackResourcesRequest(*cloudformation.ListStackResourcesInput) (*request.Request, *cloudformation.ListStackResourcesOutput)
ListStackResourcesPages(*cloudformation.ListStackResourcesInput, func(*cloudformation.ListStackResourcesOutput, bool) bool) error
ListStackResourcesPagesWithContext(aws.Context, *cloudformation.ListStackResourcesInput, func(*cloudformation.ListStackResourcesOutput, bool) bool, ...request.Option) error
ListStacks(*cloudformation.ListStacksInput) (*cloudformation.ListStacksOutput, error)
ListStacksWithContext(aws.Context, *cloudformation.ListStacksInput, ...request.Option) (*cloudformation.ListStacksOutput, error)
ListStacksRequest(*cloudformation.ListStacksInput) (*request.Request, *cloudformation.ListStacksOutput)
ListStacksPages(*cloudformation.ListStacksInput, func(*cloudformation.ListStacksOutput, bool) bool) error
ListStacksPagesWithContext(aws.Context, *cloudformation.ListStacksInput, func(*cloudformation.ListStacksOutput, bool) bool, ...request.Option) error
SetStackPolicy(*cloudformation.SetStackPolicyInput) (*cloudformation.SetStackPolicyOutput, error)
SetStackPolicyWithContext(aws.Context, *cloudformation.SetStackPolicyInput, ...request.Option) (*cloudformation.SetStackPolicyOutput, error)
SetStackPolicyRequest(*cloudformation.SetStackPolicyInput) (*request.Request, *cloudformation.SetStackPolicyOutput)
SignalResource(*cloudformation.SignalResourceInput) (*cloudformation.SignalResourceOutput, error)
SignalResourceWithContext(aws.Context, *cloudformation.SignalResourceInput, ...request.Option) (*cloudformation.SignalResourceOutput, error)
SignalResourceRequest(*cloudformation.SignalResourceInput) (*request.Request, *cloudformation.SignalResourceOutput)
UpdateStack(*cloudformation.UpdateStackInput) (*cloudformation.UpdateStackOutput, error)
UpdateStackWithContext(aws.Context, *cloudformation.UpdateStackInput, ...request.Option) (*cloudformation.UpdateStackOutput, error)
UpdateStackRequest(*cloudformation.UpdateStackInput) (*request.Request, *cloudformation.UpdateStackOutput)
ValidateTemplate(*cloudformation.ValidateTemplateInput) (*cloudformation.ValidateTemplateOutput, error)
ValidateTemplateWithContext(aws.Context, *cloudformation.ValidateTemplateInput, ...request.Option) (*cloudformation.ValidateTemplateOutput, error)
ValidateTemplateRequest(*cloudformation.ValidateTemplateInput) (*request.Request, *cloudformation.ValidateTemplateOutput)
WaitUntilStackCreateComplete(*cloudformation.DescribeStacksInput) error
WaitUntilStackCreateCompleteWithContext(aws.Context, *cloudformation.DescribeStacksInput, ...request.WaiterOption) error
WaitUntilStackDeleteComplete(*cloudformation.DescribeStacksInput) error
WaitUntilStackDeleteCompleteWithContext(aws.Context, *cloudformation.DescribeStacksInput, ...request.WaiterOption) error
WaitUntilStackExists(*cloudformation.DescribeStacksInput) error
WaitUntilStackExistsWithContext(aws.Context, *cloudformation.DescribeStacksInput, ...request.WaiterOption) error
WaitUntilStackUpdateComplete(*cloudformation.DescribeStacksInput) error
WaitUntilStackUpdateCompleteWithContext(aws.Context, *cloudformation.DescribeStacksInput, ...request.WaiterOption) error
}
var _ CloudFormationAPI = (*cloudformation.CloudFormation)(nil)
+40
View File
@@ -0,0 +1,40 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudformation
const (
// ErrCodeAlreadyExistsException for service response error code
// "AlreadyExistsException".
//
// Resource with the name requested already exists.
ErrCodeAlreadyExistsException = "AlreadyExistsException"
// ErrCodeChangeSetNotFoundException for service response error code
// "ChangeSetNotFound".
//
// The specified change set name or ID doesn't exit. To view valid change sets
// for a stack, use the ListChangeSets action.
ErrCodeChangeSetNotFoundException = "ChangeSetNotFound"
// ErrCodeInsufficientCapabilitiesException for service response error code
// "InsufficientCapabilitiesException".
//
// The template contains resources with capabilities that were not specified
// in the Capabilities parameter.
ErrCodeInsufficientCapabilitiesException = "InsufficientCapabilitiesException"
// ErrCodeInvalidChangeSetStatusException for service response error code
// "InvalidChangeSetStatus".
//
// The specified change set cannot be used to update the stack. For example,
// the change set status might be CREATE_IN_PROGRESS or the stack status might
// be UPDATE_IN_PROGRESS.
ErrCodeInvalidChangeSetStatusException = "InvalidChangeSetStatus"
// ErrCodeLimitExceededException for service response error code
// "LimitExceededException".
//
// Quota for the resource has already been reached.
ErrCodeLimitExceededException = "LimitExceededException"
)
@@ -0,0 +1,712 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudformation_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudformation"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudFormation_CancelUpdateStack() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.CancelUpdateStackInput{
StackName: aws.String("StackName"), // Required
}
resp, err := svc.CancelUpdateStack(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)
}
func ExampleCloudFormation_ContinueUpdateRollback() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.ContinueUpdateRollbackInput{
StackName: aws.String("StackNameOrId"), // Required
ResourcesToSkip: []*string{
aws.String("ResourceToSkip"), // Required
// More values...
},
RoleARN: aws.String("RoleARN"),
}
resp, err := svc.ContinueUpdateRollback(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)
}
func ExampleCloudFormation_CreateChangeSet() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.CreateChangeSetInput{
ChangeSetName: aws.String("ChangeSetName"), // Required
StackName: aws.String("StackNameOrId"), // Required
Capabilities: []*string{
aws.String("Capability"), // Required
// More values...
},
ChangeSetType: aws.String("ChangeSetType"),
ClientToken: aws.String("ClientToken"),
Description: aws.String("Description"),
NotificationARNs: []*string{
aws.String("NotificationARN"), // Required
// More values...
},
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
ResourceTypes: []*string{
aws.String("ResourceType"), // Required
// More values...
},
RoleARN: aws.String("RoleARN"),
Tags: []*cloudformation.Tag{
{ // Required
Key: aws.String("TagKey"),
Value: aws.String("TagValue"),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
UsePreviousTemplate: aws.Bool(true),
}
resp, err := svc.CreateChangeSet(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)
}
func ExampleCloudFormation_CreateStack() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.CreateStackInput{
StackName: aws.String("StackName"), // Required
Capabilities: []*string{
aws.String("Capability"), // Required
// More values...
},
DisableRollback: aws.Bool(true),
NotificationARNs: []*string{
aws.String("NotificationARN"), // Required
// More values...
},
OnFailure: aws.String("OnFailure"),
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
ResourceTypes: []*string{
aws.String("ResourceType"), // Required
// More values...
},
RoleARN: aws.String("RoleARN"),
StackPolicyBody: aws.String("StackPolicyBody"),
StackPolicyURL: aws.String("StackPolicyURL"),
Tags: []*cloudformation.Tag{
{ // Required
Key: aws.String("TagKey"),
Value: aws.String("TagValue"),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
TimeoutInMinutes: aws.Int64(1),
}
resp, err := svc.CreateStack(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)
}
func ExampleCloudFormation_DeleteChangeSet() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.DeleteChangeSetInput{
ChangeSetName: aws.String("ChangeSetNameOrId"), // Required
StackName: aws.String("StackNameOrId"),
}
resp, err := svc.DeleteChangeSet(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)
}
func ExampleCloudFormation_DeleteStack() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.DeleteStackInput{
StackName: aws.String("StackName"), // Required
RetainResources: []*string{
aws.String("LogicalResourceId"), // Required
// More values...
},
RoleARN: aws.String("RoleARN"),
}
resp, err := svc.DeleteStack(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)
}
func ExampleCloudFormation_DescribeAccountLimits() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.DescribeAccountLimitsInput{
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeAccountLimits(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)
}
func ExampleCloudFormation_DescribeChangeSet() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.DescribeChangeSetInput{
ChangeSetName: aws.String("ChangeSetNameOrId"), // Required
NextToken: aws.String("NextToken"),
StackName: aws.String("StackNameOrId"),
}
resp, err := svc.DescribeChangeSet(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)
}
func ExampleCloudFormation_DescribeStackEvents() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.DescribeStackEventsInput{
NextToken: aws.String("NextToken"),
StackName: aws.String("StackName"),
}
resp, err := svc.DescribeStackEvents(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)
}
func ExampleCloudFormation_DescribeStackResource() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.DescribeStackResourceInput{
LogicalResourceId: aws.String("LogicalResourceId"), // Required
StackName: aws.String("StackName"), // Required
}
resp, err := svc.DescribeStackResource(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)
}
func ExampleCloudFormation_DescribeStackResources() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.DescribeStackResourcesInput{
LogicalResourceId: aws.String("LogicalResourceId"),
PhysicalResourceId: aws.String("PhysicalResourceId"),
StackName: aws.String("StackName"),
}
resp, err := svc.DescribeStackResources(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)
}
func ExampleCloudFormation_DescribeStacks() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.DescribeStacksInput{
NextToken: aws.String("NextToken"),
StackName: aws.String("StackName"),
}
resp, err := svc.DescribeStacks(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)
}
func ExampleCloudFormation_EstimateTemplateCost() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.EstimateTemplateCostInput{
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
}
resp, err := svc.EstimateTemplateCost(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)
}
func ExampleCloudFormation_ExecuteChangeSet() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.ExecuteChangeSetInput{
ChangeSetName: aws.String("ChangeSetNameOrId"), // Required
StackName: aws.String("StackNameOrId"),
}
resp, err := svc.ExecuteChangeSet(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)
}
func ExampleCloudFormation_GetStackPolicy() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.GetStackPolicyInput{
StackName: aws.String("StackName"), // Required
}
resp, err := svc.GetStackPolicy(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)
}
func ExampleCloudFormation_GetTemplate() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.GetTemplateInput{
ChangeSetName: aws.String("ChangeSetNameOrId"),
StackName: aws.String("StackName"),
TemplateStage: aws.String("TemplateStage"),
}
resp, err := svc.GetTemplate(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)
}
func ExampleCloudFormation_GetTemplateSummary() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.GetTemplateSummaryInput{
StackName: aws.String("StackNameOrId"),
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
}
resp, err := svc.GetTemplateSummary(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)
}
func ExampleCloudFormation_ListChangeSets() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.ListChangeSetsInput{
StackName: aws.String("StackNameOrId"), // Required
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListChangeSets(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)
}
func ExampleCloudFormation_ListExports() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.ListExportsInput{
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListExports(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)
}
func ExampleCloudFormation_ListImports() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.ListImportsInput{
ExportName: aws.String("ExportName"), // Required
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListImports(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)
}
func ExampleCloudFormation_ListStackResources() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.ListStackResourcesInput{
StackName: aws.String("StackName"), // Required
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListStackResources(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)
}
func ExampleCloudFormation_ListStacks() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.ListStacksInput{
NextToken: aws.String("NextToken"),
StackStatusFilter: []*string{
aws.String("StackStatus"), // Required
// More values...
},
}
resp, err := svc.ListStacks(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)
}
func ExampleCloudFormation_SetStackPolicy() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.SetStackPolicyInput{
StackName: aws.String("StackName"), // Required
StackPolicyBody: aws.String("StackPolicyBody"),
StackPolicyURL: aws.String("StackPolicyURL"),
}
resp, err := svc.SetStackPolicy(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)
}
func ExampleCloudFormation_SignalResource() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.SignalResourceInput{
LogicalResourceId: aws.String("LogicalResourceId"), // Required
StackName: aws.String("StackNameOrId"), // Required
Status: aws.String("ResourceSignalStatus"), // Required
UniqueId: aws.String("ResourceSignalUniqueId"), // Required
}
resp, err := svc.SignalResource(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)
}
func ExampleCloudFormation_UpdateStack() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.UpdateStackInput{
StackName: aws.String("StackName"), // Required
Capabilities: []*string{
aws.String("Capability"), // Required
// More values...
},
NotificationARNs: []*string{
aws.String("NotificationARN"), // Required
// More values...
},
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
ResourceTypes: []*string{
aws.String("ResourceType"), // Required
// More values...
},
RoleARN: aws.String("RoleARN"),
StackPolicyBody: aws.String("StackPolicyBody"),
StackPolicyDuringUpdateBody: aws.String("StackPolicyDuringUpdateBody"),
StackPolicyDuringUpdateURL: aws.String("StackPolicyDuringUpdateURL"),
StackPolicyURL: aws.String("StackPolicyURL"),
Tags: []*cloudformation.Tag{
{ // Required
Key: aws.String("TagKey"),
Value: aws.String("TagValue"),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
UsePreviousTemplate: aws.Bool(true),
}
resp, err := svc.UpdateStack(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)
}
func ExampleCloudFormation_ValidateTemplate() {
sess := session.Must(session.NewSession())
svc := cloudformation.New(sess)
params := &cloudformation.ValidateTemplateInput{
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
}
resp, err := svc.ValidateTemplate(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)
}
+109
View File
@@ -0,0 +1,109 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudformation
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/query"
)
// AWS CloudFormation allows you to create and manage AWS infrastructure deployments
// predictably and repeatedly. You can use AWS CloudFormation to leverage AWS
// products, such as Amazon Elastic Compute Cloud, Amazon Elastic Block Store,
// Amazon Simple Notification Service, Elastic Load Balancing, and Auto Scaling
// to build highly-reliable, highly scalable, cost-effective applications without
// creating or configuring the underlying AWS infrastructure.
//
// With AWS CloudFormation, you declare all of your resources and dependencies
// in a template file. The template defines a collection of resources as a single
// unit called a stack. AWS CloudFormation creates and deletes all member resources
// of the stack together and manages all dependencies between the resources
// for you.
//
// For more information about AWS CloudFormation, see the AWS CloudFormation
// Product Page (http://aws.amazon.com/cloudformation/).
//
// Amazon CloudFormation makes use of other AWS products. For additional technical
// information about a specific AWS product, see its technical documentation
// (http://docs.aws.amazon.com/).
// The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15
type CloudFormation struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "cloudformation" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the CloudFormation client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudFormation client from just a session.
// svc := cloudformation.New(mySession)
//
// // Create a CloudFormation client with additional configuration
// svc := cloudformation.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudFormation {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *CloudFormation {
svc := &CloudFormation{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2010-05-15",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudFormation operation and runs any
// custom request initialization.
func (c *CloudFormation) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}
+259
View File
@@ -0,0 +1,259 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudformation
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
)
// WaitUntilStackCreateComplete uses the AWS CloudFormation API operation
// DescribeStacks to wait for a condition to be met before returning.
// If the condition is not meet within the max attempt window an error will
// be returned.
func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput) error {
return c.WaitUntilStackCreateCompleteWithContext(aws.BackgroundContext(), input)
}
// WaitUntilStackCreateCompleteWithContext is an extended version of WaitUntilStackCreateComplete.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *CloudFormation) WaitUntilStackCreateCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilStackCreateComplete",
MaxAttempts: 120,
Delay: request.ConstantWaiterDelay(30 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "CREATE_COMPLETE",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "CREATE_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "DELETE_COMPLETE",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "DELETE_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_COMPLETE",
},
{
State: request.FailureWaiterState,
Matcher: request.ErrorWaiterMatch,
Expected: "ValidationError",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
req, _ := c.DescribeStacksRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}
// WaitUntilStackDeleteComplete uses the AWS CloudFormation API operation
// DescribeStacks to wait for a condition to be met before returning.
// If the condition is not meet within the max attempt window an error will
// be returned.
func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput) error {
return c.WaitUntilStackDeleteCompleteWithContext(aws.BackgroundContext(), input)
}
// WaitUntilStackDeleteCompleteWithContext is an extended version of WaitUntilStackDeleteComplete.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *CloudFormation) WaitUntilStackDeleteCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilStackDeleteComplete",
MaxAttempts: 120,
Delay: request.ConstantWaiterDelay(30 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "DELETE_COMPLETE",
},
{
State: request.SuccessWaiterState,
Matcher: request.ErrorWaiterMatch,
Expected: "ValidationError",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "DELETE_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "CREATE_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_IN_PROGRESS",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
req, _ := c.DescribeStacksRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}
// WaitUntilStackExists uses the AWS CloudFormation API operation
// DescribeStacks to wait for a condition to be met before returning.
// If the condition is not meet within the max attempt window an error will
// be returned.
func (c *CloudFormation) WaitUntilStackExists(input *DescribeStacksInput) error {
return c.WaitUntilStackExistsWithContext(aws.BackgroundContext(), input)
}
// WaitUntilStackExistsWithContext is an extended version of WaitUntilStackExists.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *CloudFormation) WaitUntilStackExistsWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilStackExists",
MaxAttempts: 20,
Delay: request.ConstantWaiterDelay(5 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.StatusWaiterMatch,
Expected: 200,
},
{
State: request.RetryWaiterState,
Matcher: request.ErrorWaiterMatch,
Expected: "ValidationError",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
req, _ := c.DescribeStacksRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}
// WaitUntilStackUpdateComplete uses the AWS CloudFormation API operation
// DescribeStacks to wait for a condition to be met before returning.
// If the condition is not meet within the max attempt window an error will
// be returned.
func (c *CloudFormation) WaitUntilStackUpdateComplete(input *DescribeStacksInput) error {
return c.WaitUntilStackUpdateCompleteWithContext(aws.BackgroundContext(), input)
}
// WaitUntilStackUpdateCompleteWithContext is an extended version of WaitUntilStackUpdateComplete.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *CloudFormation) WaitUntilStackUpdateCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilStackUpdateComplete",
MaxAttempts: 120,
Delay: request.ConstantWaiterDelay(30 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "UPDATE_COMPLETE",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "UPDATE_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_FAILED",
},
{
State: request.FailureWaiterState,
Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_COMPLETE",
},
{
State: request.FailureWaiterState,
Matcher: request.ErrorWaiterMatch,
Expected: "ValidationError",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
req, _ := c.DescribeStacksRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}