diff --git a/invoke.go b/invoke.go index 29e53d77a8..53a262911d 100644 --- a/invoke.go +++ b/invoke.go @@ -14,7 +14,6 @@ import ( "encoding/json" "github.com/awslabs/goformation" - "github.com/awslabs/goformation/resources" "github.com/codegangsta/cli" ) @@ -36,48 +35,40 @@ func invoke(c *cli.Context) { } filename := getTemplateFilename(c.String("template")) - template, _, errs := goformation.Open(filename) - if len(errs) > 0 { - for _, err := range errs { - log.Printf("%s\n", err) - } - os.Exit(1) + template, err := goformation.Open(filename) + if err != nil { + log.Fatalf("Failed to parse template: %s\n", err) } - log.Printf("Successfully parsed %s (version %s)\n", filename, template.Version()) + log.Printf("Successfully parsed %s\n", filename) name := c.Args().First() // Find the specified function in the SAM template. Either check for a function whose // logical ID matches the first CLI argument, or if they only have a single function // defined, and don't specify a name, then just use that function. - var function resources.AWSServerlessFunction - functions := template.GetResourcesByType("AWS::Serverless::Function") - for resourceName, resource := range functions { - if resourceName == name || (len(functions) == 1 && name == "") { - if f, ok := resource.(resources.AWSServerlessFunction); ok { + functions := template.GetAllAWSServerlessFunctionResources() + function, found := functions[name] + if !found { + if len(functions) == 1 && name == "" { + for _, f := range functions { function = f } - } - } - - if function == nil { - - if name == "" { - fmt.Fprintf(os.Stderr, "ERROR: You must provide a function identifier (function's Logical ID in the SAM template) as the first argument.\n") } else { - fmt.Fprintf(os.Stderr, "ERROR: Could not find a AWS::Serverless::Function with logical ID '%s'\n", name) - } - - // If have functions defined in the template, be helpful and suggest them - if len(functions) > 0 { - fmt.Fprintf(os.Stderr, "Possible options in your template:\n") - for resourceName := range functions { - fmt.Fprintf(os.Stderr, " * %s\n", resourceName) + if name == "" { + fmt.Fprintf(os.Stderr, "ERROR: You must provide a function identifier (function's Logical ID in the SAM template) as the first argument.\n") + } else { + fmt.Fprintf(os.Stderr, "ERROR: Could not find a AWS::Serverless::Function with logical ID '%s'\n", name) } + // If have functions defined in the template, be helpful and suggest them + if len(functions) > 0 { + fmt.Fprintf(os.Stderr, "Possible options in your template:\n") + for resourceName := range functions { + fmt.Fprintf(os.Stderr, " * %s\n", resourceName) + } + } + os.Exit(1) } - os.Exit(1) - } // Check connectivity to docker @@ -132,7 +123,7 @@ func invoke(c *cli.Context) { DebugPort: c.String("debug-port"), }) if err != nil { - log.Fatalf("Could not initiate %s runtime: %s\n", function.Runtime(), err) + log.Fatalf("Could not initiate %s runtime: %s\n", function.Runtime, err) } eventFile := c.String("event") diff --git a/runtime.go b/runtime.go index 6995b1bade..554465dfaf 100644 --- a/runtime.go +++ b/runtime.go @@ -21,7 +21,7 @@ import ( "syscall" "github.com/aws/aws-sdk-go/aws/session" - "github.com/awslabs/goformation/resources" + "github.com/awslabs/goformation/cloudformation" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" @@ -49,7 +49,7 @@ type Runtime struct { Image string Cwd string DecompressedCwd string - Function resources.AWSServerlessFunction + Function cloudformation.AWSServerlessFunction EnvVarOverrides map[string]string DebugPort string Context context.Context @@ -93,7 +93,7 @@ var runtimeImageFor = map[string]string{ // NewRuntimeOpt contains parameters that are passed to the NewRuntime method type NewRuntimeOpt struct { - Function resources.AWSServerlessFunction + Function cloudformation.AWSServerlessFunction EnvVarsOverrides map[string]string Basedir string CheckWorkingDirExist bool @@ -103,7 +103,7 @@ type NewRuntimeOpt struct { // NewRuntime instantiates a Lambda runtime container func NewRuntime(opt NewRuntimeOpt) (Invoker, error) { // Determine which docker image to use for the provided runtime - image, found := runtimeImageFor[opt.Function.Runtime()] + image, found := runtimeImageFor[opt.Function.Runtime] if !found { return nil, ErrRuntimeNotSupported } @@ -113,13 +113,18 @@ func NewRuntime(opt NewRuntimeOpt) (Invoker, error) { return nil, err } - cwd, err := getWorkingDir(opt.Basedir, opt.Function.CodeURI().String(), opt.CheckWorkingDirExist) + codeuri := "" + if opt.Function.CodeUri != nil && opt.Function.CodeUri.String != nil { + codeuri = *opt.Function.CodeUri.String + } + + cwd, err := getWorkingDir(opt.Basedir, codeuri, opt.CheckWorkingDirExist) if err != nil { return nil, err } r := &Runtime{ - Name: opt.Function.Runtime(), + Name: opt.Function.Runtime, Cwd: cwd, Image: image, Function: opt.Function, @@ -139,7 +144,7 @@ func NewRuntime(opt NewRuntimeOpt) (Invoker, error) { return nil, err } - log.Printf("Fetching %s image for %s runtime...\n", r.Image, opt.Function.Runtime()) + log.Printf("Fetching %s image for %s runtime...\n", r.Image, opt.Function.Runtime) progress, err := cli.ImagePull(r.Context, r.Image, types.ImagePullOptions{}) if len(images) < 0 && err != nil { log.Fatalf("Could not fetch %s Docker image\n%s", r.Image, err) @@ -212,7 +217,7 @@ func (r *Runtime) getHostConfig() (*container.HostConfig, error) { host := &container.HostConfig{ Resources: container.Resources{ - Memory: int64(r.Function.MemorySize() * 1024 * 1024), + Memory: int64(r.Function.MemorySize * 1024 * 1024), }, Binds: []string{ fmt.Sprintf("%s:/var/task:ro", mount), @@ -232,7 +237,7 @@ func (r *Runtime) getHostConfig() (*container.HostConfig, error) { // and stderr (runtime logs). func (r *Runtime) Invoke(event string) (io.Reader, io.Reader, error) { - log.Printf("Invoking %s (%s)\n", r.Function.Handler(), r.Name) + log.Printf("Invoking %s (%s)\n", r.Function.Handler, r.Name) // If the CodeUri has been specified as a .jar or .zip file, unzip it on the fly if strings.HasSuffix(r.Cwd, ".jar") || strings.HasSuffix(r.Cwd, ".zip") { @@ -255,7 +260,7 @@ func (r *Runtime) Invoke(event string) (io.Reader, io.Reader, error) { Tty: false, ExposedPorts: r.getDebugExposedPorts(), Entrypoint: r.getDebugEntrypoint(), - Cmd: []string{r.Function.Handler(), event}, + Cmd: []string{r.Function.Handler, event}, Env: func() []string { result := []string{} for k, v := range env { @@ -314,13 +319,13 @@ func (r *Runtime) Invoke(event string) (io.Reader, io.Reader, error) { func (r *Runtime) setupTimeoutTimer(stdout, stderr io.ReadCloser) { // Start a timer, we'll use this to abort the function if it runs beyond the specified timeout timeout := time.Duration(3) * time.Second - if r.Function.Timeout() > 0 { - timeout = time.Duration(r.Function.Timeout()) * time.Second + if r.Function.Timeout > 0 { + timeout = time.Duration(r.Function.Timeout) * time.Second } r.TimeoutTimer = time.NewTimer(timeout) go func() { <-r.TimeoutTimer.C - log.Printf("Function %s timed out after %d seconds", r.Function.Handler(), timeout/time.Second) + log.Printf("Function %s timed out after %d seconds", r.Function.Handler, timeout/time.Second) stderr.Close() stdout.Close() r.CleanUp() @@ -332,7 +337,7 @@ func (r *Runtime) setupInterruptHandler(stdout, stderr io.ReadCloser) { signal.Notify(iChan, os.Interrupt, syscall.SIGTERM) go func() { <-iChan - log.Printf("Execution of function %q was interrupted", r.Function.Handler()) + log.Printf("Execution of function %q was interrupted", r.Function.Handler) stderr.Close() stdout.Close() r.CleanUp() @@ -475,7 +480,7 @@ func (r *Runtime) getDebugEntrypoint() (overrides []string) { This priority also applies to AWS_* system variables */ -func getEnvironmentVariables(function resources.AWSServerlessFunction, overrides map[string]string) map[string]string { +func getEnvironmentVariables(function cloudformation.AWSServerlessFunction, overrides map[string]string) map[string]string { creds := getSessionOrDefaultCreds() @@ -487,9 +492,9 @@ func getEnvironmentVariables(function resources.AWSServerlessFunction, overrides "AWS_ACCESS_KEY_ID": creds["key"], "AWS_SECRET_ACCESS_KEY": creds["secret"], "AWS_SESSION_TOKEN": creds["sessiontoken"], - "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": strconv.Itoa(int(function.MemorySize())), - "AWS_LAMBDA_FUNCTION_TIMEOUT": strconv.Itoa(int(function.Timeout())), - "AWS_LAMBDA_FUNCTION_HANDLER": function.Handler(), + "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": strconv.Itoa(int(function.MemorySize)), + "AWS_LAMBDA_FUNCTION_TIMEOUT": strconv.Itoa(int(function.Timeout)), + "AWS_LAMBDA_FUNCTION_HANDLER": function.Handler, // "AWS_ACCOUNT_ID=", // "AWS_LAMBDA_EVENT_BODY=", // "AWS_REGION=", @@ -499,27 +504,30 @@ func getEnvironmentVariables(function resources.AWSServerlessFunction, overrides // Get all env vars from SAM file. Use values if it was hard-coded osEnviron := getOsEnviron() - for name, value := range function.EnvironmentVariables() { - // hard-coded values, lowest priority - if stringedValue, ok := toStringMaybe(value); ok { - // Get only hard-coded values from the template - env[name] = stringedValue - } - - // Shell's environment, second priority - if value, ok := osEnviron[name]; ok { - env[name] = value - } + if function.Environment != nil { + for name, value := range function.Environment.Variables { + // hard-coded values, lowest priority + if stringedValue, ok := toStringMaybe(value); ok { + // Get only hard-coded values from the template + env[name] = stringedValue + } - // EnvVars overrides provided by customer, highest priority - if len(overrides) > 0 { - if value, ok := overrides[name]; ok { + // Shell's environment, second priority + if value, ok := osEnviron[name]; ok { env[name] = value } + + // EnvVars overrides provided by customer, highest priority + if len(overrides) > 0 { + if value, ok := overrides[name]; ok { + env[name] = value + } + } } } return env + } // Converts the input to string if it is a primitive type, Otherwise returns nil diff --git a/runtime_test.go b/runtime_test.go index 5fc49dce12..fea70559b2 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/awslabs/goformation" - "github.com/awslabs/goformation/resources" + "github.com/awslabs/goformation/cloudformation" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -82,16 +82,15 @@ var _ = Describe("sam", func() { Context("environment variables", func() { - var functions map[string]resources.Resource + var functions map[string]cloudformation.AWSServerlessFunction BeforeEach(func() { - template, _, _ := goformation.Open("test/templates/sam-official-samples/iot_backend/template.yaml") - functions = template.GetResourcesByType("AWS::Serverless::Function") + template, _ := goformation.Open("test/templates/sam-official-samples/iot_backend/template.yaml") + functions = template.GetAllAWSServerlessFunctionResources() }) It("return defaults with those defined in the template", func() { - for _, resource := range functions { - function := resource.(resources.AWSServerlessFunction) + for _, function := range functions { variables := getEnvironmentVariables(function, map[string]string{}) Expect(variables).To(HaveLen(10)) Expect(variables).To(HaveKey("AWS_SAM_LOCAL")) @@ -108,8 +107,7 @@ var _ = Describe("sam", func() { }) It("overides template with environment variables", func() { - for _, resource := range functions { - function := resource.(resources.AWSServerlessFunction) + for _, function := range functions { variables := getEnvironmentVariables(function, map[string]string{}) Expect(variables["TABLE_NAME"]).To(Equal("")) @@ -126,8 +124,7 @@ var _ = Describe("sam", func() { "TABLE_NAME": "OVERRIDE_TABLE", } - for _, resource := range functions { - function := resource.(resources.AWSServerlessFunction) + for _, function := range functions { variables := getEnvironmentVariables(function, overrides) Expect(variables["TABLE_NAME"]).To(Equal("OVERRIDE_TABLE")) } diff --git a/start.go b/start.go index 0d05bf4d77..8f40d4a25e 100644 --- a/start.go +++ b/start.go @@ -9,10 +9,12 @@ import ( "net/http" "os" "path/filepath" + "strings" "sync" "github.com/awslabs/goformation" - "github.com/awslabs/goformation/resources" + "github.com/awslabs/goformation/cloudformation" + "github.com/codegangsta/cli" "github.com/fatih/color" "github.com/gorilla/mux" @@ -41,12 +43,9 @@ func start(c *cli.Context) { } filename := getTemplateFilename(c.String("template")) - template, _, errs := goformation.Open(filename) - if len(errs) > 0 { - for _, err := range errs { - log.Printf("%s\n", err) - } - os.Exit(1) + template, err := goformation.Open(filename) + if err != nil { + log.Fatalf("Failed to parse template: %s\n", err) } // Check connectivity to docker @@ -90,153 +89,153 @@ func start(c *cli.Context) { checkWorkingDirExist = true } - log.Printf("Successfully parsed %s (version %s)", filename, template.Version()) + log.Printf("Successfully parsed %s", filename) // Create a new HTTP router to mount the functions on router := mux.NewRouter() - functions := template.GetResourcesByType("AWS::Serverless::Function") + functions := template.GetAllAWSServerlessFunctionResources() // Keep track of successfully mounted functions, used for error reporting mounts := []mount{} endpointCount := 0 - for name, resource := range functions { + for name, function := range functions { - if function, ok := resource.(resources.AWSServerlessFunction); ok { + var events []cloudformation.AWSServerlessFunction_ApiEvent + for _, event := range function.Events { + if event.Type == "Api" { + if event.Properties.ApiEvent != nil { + events = append(events, *event.Properties.ApiEvent) + } + } + } + + for _, event := range events { + + endpointCount++ - endpoints, err := function.Endpoints() + // Find the env-vars map for the function + funcEnvVarsOverrides := envVarsOverrides[name] + + runt, err := NewRuntime(NewRuntimeOpt{ + Function: function, + EnvVarsOverrides: funcEnvVarsOverrides, + Basedir: filepath.Dir(filename), + CheckWorkingDirExist: checkWorkingDirExist, + DebugPort: c.String("debug-port"), + }) if err != nil { - log.Printf("Error while parsing API endpoints for %s: %s\n", function.Handler(), err) - continue + if err == ErrRuntimeNotSupported { + log.Printf("Ignoring %s due to unsupported runtime (%s)\n", function.Handler, function.Runtime) + continue + } else { + log.Printf("Ignoring %s due to %s runtime init error: %s\n", function.Handler, function.Runtime, err) + continue + } } - for x := range endpoints { + // Work out which HTTP methods to respond to + methods := getHTTPMethods(event.Method) - endpoint := endpoints[x].(resources.AWSServerlessFunctionEndpoint) - endpointCount++ + // Keep track of this successful mount, for displaying to the user + mounts = append(mounts, mount{ + Handler: function.Handler, + Runtime: function.Runtime, + Endpoint: event.Path, + Methods: methods, + }) - // Find the env-vars map for the function - funcEnvVarsOverrides := envVarsOverrides[name] + router.HandleFunc(event.Path, func(w http.ResponseWriter, r *http.Request) { - runt, err := NewRuntime(NewRuntimeOpt{ - Function: function, - EnvVarsOverrides: funcEnvVarsOverrides, - Basedir: baseDir, - CheckWorkingDirExist: checkWorkingDirExist, - DebugPort: c.String("debug-port"), - }) + var wg sync.WaitGroup + + w.Header().Set("Content-Type", "application/json") + + event, err := NewEvent(r) if err != nil { - if err == ErrRuntimeNotSupported { - log.Printf("Ignoring %s due to unsupported runtime (%s)\n", function.Handler(), function.Runtime()) - continue - } else { - log.Printf("Ignoring %s due to %s runtime init error: %s\n", function.Handler(), function.Runtime(), err) - continue - } + msg := fmt.Sprintf("Error invoking %s runtime: %s", function.Runtime, err) + log.Println(msg) + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte(`{ "message": "Internal server error" }`)) + return } - // Keep track of this successful mount, for displaying to the user - mounts = append(mounts, mount{ - Handler: function.Handler(), - Runtime: function.Runtime(), - Endpoint: endpoint.Path(), - Methods: endpoint.Methods(), - }) - - router.HandleFunc(endpoint.Path(), func(w http.ResponseWriter, r *http.Request) { + eventJSON, err := event.JSON() + if err != nil { + msg := fmt.Sprintf("Error invoking %s runtime: %s", function.Runtime, err) + log.Println(msg) + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte(`{ "message": "Internal server error" }`)) + return + } - var wg sync.WaitGroup + stdoutTxt, stderrTxt, err := runt.Invoke(eventJSON) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte(`{ "message": "Internal server error" }`)) + return + } - w.Header().Set("Content-Type", "application/json") + wg.Add(1) + go func() { - event, err := NewEvent(r) + result, err := ioutil.ReadAll(stdoutTxt) if err != nil { - msg := fmt.Sprintf("Error invoking %s runtime: %s", function.Runtime(), err) - log.Println(msg) - w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(`{ "message": "Internal server error" }`)) - return - } - - eventJSON, err := event.JSON() - if err != nil { - msg := fmt.Sprintf("Error invoking %s runtime: %s", function.Runtime(), err) - log.Println(msg) w.WriteHeader(http.StatusInternalServerError) w.Write([]byte(`{ "message": "Internal server error" }`)) + wg.Done() return } - stdoutTxt, stderrTxt, err := runt.Invoke(eventJSON) - if err != nil { - log.Printf("ERROR: %s\n", err) + // At this point, we need to see whether the response is in the format + // of a Lambda proxy response (inc statusCode / body), and if so, handle it + // otherwise just copy the whole output back to the http.ResponseWriter + proxy := &struct { + StatusCode int `json:"statusCode"` + Headers map[string]string `json:"headers"` + Body json.Number `json:"body"` + }{} + + if err := json.Unmarshal(result, proxy); err != nil || (proxy.StatusCode == 0 && len(proxy.Headers) == 0 && proxy.Body == "") { + // This is not a proxy integration function, as the response doesn't container headers, statusCode or body. + // Return HTTP 501 (Internal Server Error) to match Lambda behaviour + fmt.Fprintf(os.Stderr, color.RedString("ERROR: Function %s returned an invalid response (must include one of: body, headers or statusCode in the response object)\n"), name) w.WriteHeader(http.StatusInternalServerError) w.Write([]byte(`{ "message": "Internal server error" }`)) + wg.Done() return } - wg.Add(1) - go func() { - - result, err := ioutil.ReadAll(stdoutTxt) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(`{ "message": "Internal server error" }`)) - wg.Done() - return - } - - // At this point, we need to see whether the response is in the format - // of a Lambda proxy response (inc statusCode / body), and if so, handle it - // otherwise just copy the whole output back to the http.ResponseWriter - proxy := &struct { - StatusCode int `json:"statusCode"` - Headers map[string]string `json:"headers"` - Body json.Number `json:"body"` - }{} - - if err := json.Unmarshal(result, proxy); err != nil || (proxy.StatusCode == 0 && len(proxy.Headers) == 0 && proxy.Body == "") { - // This is not a proxy integration function, as the response doesn't container headers, statusCode or body. - // Return HTTP 501 (Internal Server Error) to match Lambda behaviour - fmt.Fprintf(os.Stderr, color.RedString("ERROR: Function %s returned an invalid response (must include one of: body, headers or statusCode in the response object)\n"), name) - w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(`{ "message": "Internal server error" }`)) - wg.Done() - return - } - - // Set any HTTP headers requested by the proxy function - if len(proxy.Headers) > 0 { - for key, value := range proxy.Headers { - w.Header().Set(key, value) - } - } - - // This is a proxy function, so set the http status code and return the body - if proxy.StatusCode != 0 { - w.WriteHeader(proxy.StatusCode) + // Set any HTTP headers requested by the proxy function + if len(proxy.Headers) > 0 { + for key, value := range proxy.Headers { + w.Header().Set(key, value) } + } - w.Write([]byte(proxy.Body)) - wg.Done() + // This is a proxy function, so set the http status code and return the body + if proxy.StatusCode != 0 { + w.WriteHeader(proxy.StatusCode) + } - }() + w.Write([]byte(proxy.Body)) + wg.Done() - wg.Add(1) - go func() { - // Finally, copy the container stderr (runtime logs) to the console stderr - io.Copy(stderr, stderrTxt) - wg.Done() - }() + }() - wg.Wait() + wg.Add(1) + go func() { + // Finally, copy the container stderr (runtime logs) to the console stderr + io.Copy(stderr, stderrTxt) + wg.Done() + }() - runt.CleanUp() + wg.Wait() - }).Methods(endpoint.Methods()...) + runt.CleanUp() - } + }).Methods(methods...) } } @@ -286,3 +285,13 @@ func start(c *cli.Context) { log.Fatal(http.ListenAndServe(c.String("host")+":"+c.String("port"), router)) } + +// getHttpMethods returns the HTTP method(s) supported by an API event source +func getHTTPMethods(input string) []string { + switch input { + case "any": + return []string{"OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"} + default: + return []string{strings.ToUpper(input)} + } +} diff --git a/validate.go b/validate.go index 4a6d8f2e53..9123e6925d 100644 --- a/validate.go +++ b/validate.go @@ -10,12 +10,10 @@ import ( func validate(c *cli.Context) { - _, _, errs := goformation.Open(getTemplateFilename(c.String("template"))) + _, err := goformation.Open(getTemplateFilename(c.String("template"))) - if len(errs) > 0 { - for _, err := range errs { - fmt.Fprintf(os.Stderr, "%s\n", err) - } + if err != nil { + fmt.Fprintf(os.Stderr, "%s\n", err) os.Exit(1) } diff --git a/validate_test.go b/validate_test.go index ae6e898250..91940327ce 100644 --- a/validate_test.go +++ b/validate_test.go @@ -2,9 +2,9 @@ package main import ( "github.com/awslabs/goformation" - "github.com/awslabs/goformation/resources" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" ) var _ = Describe("sam", func() { @@ -27,7 +27,7 @@ var _ = Describe("sam", func() { for _, filename := range inputs { Context("including "+filename, func() { - template, _, err := goformation.Open(filename) + template, err := goformation.Open(filename) It("should successfully validate the SAM template", func() { Expect(err).To(BeNil()) Expect(template).ShouldNot(BeNil()) @@ -47,7 +47,7 @@ var _ = Describe("sam", func() { for _, filename := range inputs { Context("including "+filename, func() { - template, _, err := goformation.Open(filename) + template, err := goformation.Open(filename) It("should successfully validate the SAM template", func() { Expect(err).To(BeNil()) Expect(template).ShouldNot(BeNil()) @@ -58,13 +58,13 @@ var _ = Describe("sam", func() { Context("with a Serverless template containing different CodeUri formats", func() { - template, _, err := goformation.Open("test/templates/aws-common-string-or-s3-location.yaml") + template, err := goformation.Open("test/templates/aws-common-string-or-s3-location.yaml") It("should successfully parse the template", func() { Expect(err).To(BeNil()) Expect(template).ShouldNot(BeNil()) }) - functions := template.GetResourcesByType("AWS::Serverless::Function") + functions := template.GetAllAWSServerlessFunctionResources() It("should have exactly three functions", func() { Expect(functions).To(HaveLen(3)) @@ -73,32 +73,34 @@ var _ = Describe("sam", func() { Expect(functions).To(HaveKey("CodeUriWithString")) }) - f1 := functions["CodeUriWithS3LocationSpecifiedAsString"].(resources.AWSServerlessFunction) + f1 := functions["CodeUriWithS3LocationSpecifiedAsString"] It("should parse a CodeUri property with an S3 location specified as a string", func() { - Expect(f1.CodeURI().String()).To(Equal("s3://testbucket/testkey.zip")) + Expect(f1.CodeUri.String).To(PointTo(Equal("s3://testbucket/testkey.zip"))) }) - f2 := functions["CodeUriWithS3LocationSpecifiedAsObject"].(resources.AWSServerlessFunction) + f2 := functions["CodeUriWithS3LocationSpecifiedAsObject"] It("should parse a CodeUri property with an S3 location specified as an object", func() { - Expect(f2.CodeURI().String()).To(Equal("s3://testbucket/testkey.zip#5")) + Expect(f2.CodeUri.S3Location.Bucket).To(Equal("testbucket")) + Expect(f2.CodeUri.S3Location.Key).To(Equal("testkey.zip")) + Expect(f2.CodeUri.S3Location.Version).To(Equal(5)) }) - f3 := functions["CodeUriWithString"].(resources.AWSServerlessFunction) + f3 := functions["CodeUriWithString"] It("should parse a CodeUri property with a string", func() { - Expect(f3.CodeURI().String()).To(Equal("./testfolder")) + Expect(f3.CodeUri.String).To(PointTo(Equal("./testfolder"))) }) }) Context("with a Serverless template containing function environment variables", func() { - template, _, err := goformation.Open("test/templates/function-environment-variables.yaml") + template, err := goformation.Open("test/templates/function-environment-variables.yaml") It("should successfully parse the template", func() { Expect(err).To(BeNil()) Expect(template).ShouldNot(BeNil()) }) - functions := template.GetResourcesByType("AWS::Serverless::Function") + functions := template.GetAllAWSServerlessFunctionResources() It("should have exactly one function", func() { Expect(functions).To(HaveLen(5)) @@ -109,43 +111,53 @@ var _ = Describe("sam", func() { Expect(functions).To(HaveKey("NonExistSubEnvironmentVariableTestFunction")) }) - f1 := functions["EnvironmentVariableTestFunction"].(resources.AWSServerlessFunction) + f1 := functions["EnvironmentVariableTestFunction"] Context("with a simple string based variable", func() { It("should have an environment variable named STRING_ENV_VAR", func() { - Expect(f1.EnvironmentVariables()).To(HaveLen(1)) - Expect(f1.EnvironmentVariables()).To(HaveKeyWithValue("STRING_ENV_VAR", "test123")) + Expect(f1.Environment).ToNot(BeNil()) + Expect(f1.Environment.Variables).ToNot(BeNil()) + Expect(f1.Environment.Variables).To(HaveLen(1)) + Expect(f1.Environment.Variables).To(HaveKeyWithValue("STRING_ENV_VAR", "test123")) }) }) - f2 := functions["NoValueEnvironmentVariableTestFunction"].(resources.AWSServerlessFunction) + f2 := functions["NoValueEnvironmentVariableTestFunction"] Context("with an empty variable value", func() { It("should have an environment variable named EMPTY_ENV_VAR", func() { - Expect(f2.EnvironmentVariables()).To(HaveLen(1)) - Expect(f2.EnvironmentVariables()).To(HaveKeyWithValue("EMPTY_ENV_VAR", "")) + Expect(f2.Environment).ToNot(BeNil()) + Expect(f2.Environment.Variables).ToNot(BeNil()) + Expect(f2.Environment.Variables).To(HaveLen(1)) + Expect(f2.Environment.Variables).To(HaveKeyWithValue("EMPTY_ENV_VAR", "")) }) }) - f3 := functions["IntrinsicEnvironmentVariableTestFunction"].(resources.AWSServerlessFunction) + f3 := functions["IntrinsicEnvironmentVariableTestFunction"] Context("with a !Ref lookup variable", func() { It("should have an environment variable named REF_ENV_VAR", func() { - Expect(f3.EnvironmentVariables()).To(HaveLen(1)) - Expect(f3.EnvironmentVariables()).To(HaveKeyWithValue("REF_ENV_VAR", "ExampleParameter")) + Expect(f3.Environment).ToNot(BeNil()) + Expect(f3.Environment.Variables).ToNot(BeNil()) + Expect(f3.Environment.Variables).To(HaveLen(1)) + Expect(f3.Environment.Variables).To(HaveKeyWithValue("REF_ENV_VAR", "SomeValue")) }) }) - f4 := functions["SubEnvironmentVariableTestFunction"].(resources.AWSServerlessFunction) + f4 := functions["SubEnvironmentVariableTestFunction"] Context("with a !Sub variable value", func() { It("should have an environment variable named SUB_ENV_VAR", func() { - Expect(f4.EnvironmentVariables()).To(HaveLen(1)) - Expect(f4.EnvironmentVariables()).To(HaveKeyWithValue("SUB_ENV_VAR", "Hello")) + Expect(f4.Environment).ToNot(BeNil()) + Expect(f4.Environment.Variables).ToNot(BeNil()) + Expect(f4.Environment.Variables).To(HaveLen(1)) + Expect(f4.Environment.Variables).To(HaveKeyWithValue("SUB_ENV_VAR", "Hello")) }) }) - f5 := functions["NonExistSubEnvironmentVariableTestFunction"].(resources.AWSServerlessFunction) + f5 := functions["NonExistSubEnvironmentVariableTestFunction"] Context("with a !Sub variable value that contains a non-existant reference", func() { It("should have an environment variable named SUB_REF_ENV_VAR", func() { - Expect(f5.EnvironmentVariables()).To(HaveLen(1)) - Expect(f5.EnvironmentVariables()).To(HaveKeyWithValue("SUB_REF_ENV_VAR", "Hello-${ThisReferenceDoesntExist}")) + Expect(f5.Environment).ToNot(BeNil()) + Expect(f5.Environment.Variables).ToNot(BeNil()) + Expect(f5.Environment.Variables).To(HaveLen(1)) + Expect(f5.Environment.Variables).To(HaveKeyWithValue("SUB_REF_ENV_VAR", "Hello-")) }) }) @@ -153,45 +165,46 @@ var _ = Describe("sam", func() { Context("with a Serverless function matching 2016-10-31 specification", func() { - template, _, err := goformation.Open("test/templates/function-2016-10-31.yaml") + template, err := goformation.Open("test/templates/function-2016-10-31.yaml") It("should successfully validate the SAM template", func() { Expect(err).To(BeNil()) Expect(template).ShouldNot(BeNil()) }) - functions := template.GetResourcesByType("AWS::Serverless::Function") + functions := template.GetAllAWSServerlessFunctionResources() It("should have exactly one function", func() { Expect(functions).To(HaveLen(1)) Expect(functions).To(HaveKey("Function20161031")) }) - f := functions["Function20161031"].(resources.AWSServerlessFunction) + f := functions["Function20161031"] It("should correctly parse all of the function properties", func() { - Expect(f.Handler()).To(Equal("file.method")) - Expect(f.Runtime()).To(Equal("nodejs")) - Expect(f.FunctionName()).To(Equal("functionname")) - Expect(f.Description()).To(Equal("description")) - Expect(f.MemorySize()).To(Equal(128)) - Expect(f.Timeout()).To(Equal(30)) - Expect(f.Role()).To(Equal("aws::arn::123456789012::some/role")) - Expect(f.Policies()).To(ContainElement("AmazonDynamoDBFullAccess")) - Expect(f.EnvironmentVariables()).To(HaveKeyWithValue("NAME", "VALUE")) + Expect(f.Handler).To(Equal("file.method")) + Expect(f.Runtime).To(Equal("nodejs")) + Expect(f.FunctionName).To(Equal("functionname")) + Expect(f.Description).To(Equal("description")) + Expect(f.MemorySize).To(Equal(128)) + Expect(f.Timeout).To(Equal(30)) + Expect(f.Role).To(Equal("aws::arn::123456789012::some/role")) + Expect(f.Policies.StringArray).To(PointTo(ContainElement("AmazonDynamoDBFullAccess"))) + Expect(f.Environment).ToNot(BeNil()) + Expect(f.Environment.Variables).To(HaveKeyWithValue("NAME", "VALUE")) }) It("should correctly parse all of the function API event sources/endpoints", func() { - endpoints, err := f.Endpoints() - Expect(err).To(BeNil()) - - Expect(endpoints).To(HaveLen(1)) + Expect(f.Events).ToNot(BeNil()) + Expect(f.Events).To(HaveKey("TestApi")) + Expect(f.Events["TestApi"].Type).To(Equal("Api")) + Expect(f.Events["TestApi"].Properties.ApiEvent).ToNot(BeNil()) - firstEndpoint := endpoints[0] - Expect(firstEndpoint.Methods()).To(Equal([]string{"OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"})) - Expect(firstEndpoint.Path()).To(Equal("/testing")) + event := f.Events["TestApi"].Properties.ApiEvent + Expect(event.Method).To(Equal("any")) + Expect(event.Path).To(Equal("/testing")) }) @@ -205,7 +218,7 @@ var _ = Describe("sam", func() { for _, filename := range inputs { Context("including "+filename, func() { - template, _, err := goformation.Open(filename) + template, err := goformation.Open(filename) It("should successfully validate the SAM template", func() { Expect(err).To(BeNil()) Expect(template).ShouldNot(BeNil()) diff --git a/vendor/github.com/awslabs/goformation/CONTRIBUTING.md b/vendor/github.com/awslabs/goformation/CONTRIBUTING.md index 170d6b92db..f5c85f6d96 100644 --- a/vendor/github.com/awslabs/goformation/CONTRIBUTING.md +++ b/vendor/github.com/awslabs/goformation/CONTRIBUTING.md @@ -1,3 +1,29 @@ -# Contribute to AWS GoFormation +# Contributing to GoFormation -TODO. +Contributions to GoFormation should be made via GitHub [pull +requests](https://github.com/awslabs/goformation/pulls) and discussed using +GitHub [issues](https://github.com/awslabs/goformation/issues). + +### Before you start + +If you would like to make a significant change, it's a good idea to first open +an issue to discuss it. + +### Making the request + +1. Create a fork of the GoFormation repository [(quick link)](https://github.com/awslabs/goformation#fork-destination-box) +2. Commit your changes to your fork +3. Create a new pull request [(quick link)](https://github.com/awslabs/goformation/compare) + +### Testing + +Any contributions should pass all tests, including those not run by our +current CI system. + +You may run all tests by running `go test` (requires `go` to be installed). + +## Licensing + +GoFormation is released under an [Apache 2.0](http://aws.amazon.com/apache-2-0/) license. Any code you submit will be released under that license. + +For significant changes, we may ask you to sign a [Contributor License Agreement (http://en.wikipedia.org/wiki/Contributor_License_Agreement). diff --git a/vendor/github.com/awslabs/goformation/NOTICE b/vendor/github.com/awslabs/goformation/NOTICE index 4f27a7ec2d..595536ae35 100644 --- a/vendor/github.com/awslabs/goformation/NOTICE +++ b/vendor/github.com/awslabs/goformation/NOTICE @@ -1,2 +1,2 @@ -aws-goformation +GoFormation Copyright 2011-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/vendor/github.com/awslabs/goformation/README.md b/vendor/github.com/awslabs/goformation/README.md index 6ba83ea1bc..2e48351a9a 100644 --- a/vendor/github.com/awslabs/goformation/README.md +++ b/vendor/github.com/awslabs/goformation/README.md @@ -1,175 +1,224 @@ -# AWS GoFormation (Alpha) - -GoFormation is a CloudFormation parser written in Golang. By using GoFormation in your project, you can parse CloudFormation templates and use their information in your app. - -- [GoFormation (Alpha)](#aws-goformation-alpha) - - [Installation](#installation) - - [Usage](#usage) - - [Opening the template file](#opening-the-template-file) - - [Parsing template contents](#parsing-template-contents) - - [Using the parsed template](#using-the-parsed-template) - - [Resources](#resources) - - [Template-centric interfaces](#template-centric-interfaces) - - [Template](#template) - - [Resource](#resource) - - [Property](#property) - - [Resource-centric interfaces](#resource-centric-interfaces) - - [AWSServerlessFunction](#awsserverlessfunction) +# AWS GoFormation + +[![Build Status](https://travis-ci.org/awslabs/goformation.svg?branch=0.1.0)](https://travis-ci.org/awslabs/goformation) [![GoDoc Reference](https://godoc.org/gopkg.in/awslabs/goformation.v1?status.svg)](http://godoc.org/github.com/awslabs/goformation) ![Apache-2.0](https://img.shields.io/badge/Licence-Apache%202.0-blue.svg) + +`GoFormation` is a Go library for working with AWS CloudFormation / AWS Serverless Application Model (SAM) templates. +- [AWS GoFormation](#aws-goformation) + - [Main features](#main-features) + - [Installation](#installation) + - [Usage](#usage) + - [Marhsalling CloudFormation/SAM described with Go structs, into YAML/JSON](#marhsalling-cloudformationsam-described-with-go-structs-into-yamljson) + - [Unmarhalling CloudFormation YAML/JSON into Go structs](#unmarhalling-cloudformation-yamljson-into-go-structs) + - [Updating CloudFormation / SAM Resources in GoFormation](#updating-cloudformation-sam-resources-in-goformation) + - [Advanced](#advanced) + - [AWS CloudFormation Intrinsic Functions](#aws-cloudformation-intrinsic-functions) + - [Resolving References (Ref)](#resolving-references-ref) + - [Warning: YAML short form intrinsic functions (e.g. !Sub)](#warning-yaml-short-form-intrinsic-functions-eg-sub) + - [Contributing](#contributing) + +## Main features + + * Describe AWS CloudFormation and AWS SAM templates as Go objects (structs), and then turn it into JSON/YAML. + * Parse JSON/YAML AWS CloudFormation and AWS SAM templates and turn them into Go structs. + * Strongly typed Go structs generated for every AWS CloudFormation and AWS SAM resource. + * Automatically generated, from the published AWS CloudFormation Resource Specification. ## Installation -The easiest way to get GoFormation is through `go get`: +As with other Go libraries, GoFormation can be installed with `go get`. ``` -go get github.com/awslabs/aws-goformation +$ go get github.com/awslabs/goformation ``` -This will get you a fresh copy of AWS GoFormation directly from the repository, into your `$GOPATH`. - ## Usage -For using GoFormation you just need to reference in your Go app, whenever you want to use it: - -### Opening the template file +### Marhsalling CloudFormation/SAM described with Go structs, into YAML/JSON -If you want GoFormation to manage the opening of the file before the parsing, the way to proceed is `goformation.Open("template-file.yaml")`: +Below is an example of building a CloudFormation template programatically, then outputting the resulting JSON -``` -// my_file.go +```go package main -import "github.com/awslabs/goformation" +import ( + "fmt" + "github.com/awslabs/goformation" + "github.com/awslabs/goformation/cloudformation" +) func main() { - template, errors, logs := goformation.Open("my-template.yaml") - // Do something with your template parsed. -} -``` - -### Parsing template contents -If you rather use directly the contents of a template, then you should use `goformation.Parse("template-contents")`: + // Create a new CloudFormation template + template := cloudformation.NewTemplate() + + // An an example SNS Topic + template.Resources["MySNSTopic"] = cloudformation.AWSSNSTopic{ + DisplayName: "test-sns-topic-display-name", + TopicName: "test-sns-topic-name", + Subscription: []cloudformation.AWSSNSTopic_Subscription{ + cloudformation.AWSSNSTopic_Subscription{ + Endpoint: "test-sns-topic-subscription-endpoint", + Protocol: "test-sns-topic-subscription-protocol", + }, + }, + } + + // ...and a Route 53 Hosted Zone too + template.Resources["MyRoute53HostedZone"] = cloudformation.AWSRoute53HostedZone{ + Name: "example.com", + } + + // Let's see the JSON + j, err := template.JSON() + if err != nil { + fmt.Printf("Failed to generate JSON: %s\n", err) + } else { + fmt.Print(j) + } + + y, err := template.YAML() + if err != nil { + fmt.Printf("Failed to generate JSON: %s\n", err) + } else { + fmt.Print(y) + } +} ``` -// my_file.go -package main -import "github.com/awslabs/goformation" - -func main() { - var textTemplate []byte = ... // Get your template's contents somewhere - template, errors, logs := goformation.Parse(textTemplate) - // Do something with your template parsed. +Would output the following JSON template + +```javascript +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Resources": { + "MyRoute53HostedZone": { + "Name": "example.com" + }, + "MySNSTopic": { + "DisplayName": "test-sns-topic-display-name", + "Subscription": [ + { + "Endpoint": "test-sns-topic-subscription-endpoint", + "Protocol": "test-sns-topic-subscription-protocol" + } + ], + "TopicName": "test-sns-topic-name" + } + } } ``` -### Using the parsed template +...and the following YAML template + +```yaml +AWSTemplateFormatVersion: 2010-09-09 +Resources: + MyRoute53HostedZone: + Name: example.com + MySNSTopic: + DisplayName: test-sns-topic-display-name + Subscription: + - Endpoint: test-sns-topic-subscription-endpoint + Protocol: test-sns-topic-subscription-protocol + TopicName: test-sns-topic-name +``` -Once your template is parsed, you can easily get the resources parsed, to do any action with them - _NOTE: Currently, AWS GoFormation only supports `AWS::Serverless::Function` resources._ -: -``` -// my_file.go +### Unmarhalling CloudFormation YAML/JSON into Go structs + +GoFormation also works the other way - parsing JSON/YAML CloudFormation/SAM templates into Go structs. + +```go package main import ( - "github.com/awslabs/goformation", - . "github.com/awslabs/goformation/resources" + "fmt" + "github.com/awslabs/goformation" + "github.com/awslabs/goformation/cloudformation" ) func main() { - template, errors, logs := goformation.Open("my-template.yaml") - // Verify there's no errors on parsing - resources := template.Resources() // Get All resources - functions := template.GetResourcesByType("AWS::Serverless::Function") // Get only Serverless Functions + // Open a template from file (can be JSON or YAML) + template, err := goformation.Open("template.yaml") - // Iterate over the parsed functions - for fnName, fnData := range functions { - fnParsed := fnData.(AWSServerlessFunction) + // ...or provide one as a byte array ([]byte) + template, err := goformation.Parse(data) - // Get function data - fnRuntime := fnParsed.Runtime() - log.Printf("Runtime: %s", fnRuntime) // Outputs the function's runtime - } -} -``` + // You can then inspect all of the values + for name, resource := range template.Resources { -### Resources + // E.g. Found a resource with name MyLambdaFunction and type AWS::Lambda::Function + log.Printf("Found a resource with name %s and type %s", name, resource.Type) -The inner package `resource` contains exported interfaces that are useful for working with GoFormation-parsed templates: + } -#### Template-centric interfaces + // You can extract all resources of a certain type + // Each AWS CloudFormation / SAM resource is a strongly typed struct + functions := template.GetAllAWSLambdaFunctionResources() + for name, function := range functions { -These interfaces give you means to access your template's information, and reflects the same structure that you can see on your JSON/YAML template. Once the template is parsed, these interfaces would also return computed outputs, by linking resources via Intrinsic Functions: + // E.g. Found a AWS::Lambda::Function with name MyLambdaFunction and nodejs6.10 handler + log.Printf("Found a %s with name %s and %s handler", name, function.Type(), function.Handler) -##### Template + } -``` -type Template interface { - Version() string - Transform() []string - Parameters() map[string]Parameter - Resources() map[string]Resource - Outputs() map[string]Output - - GetResourcesByType(resourceType string) map[string]Resource } ``` -##### Resource +## Updating CloudFormation / SAM Resources in GoFormation + +AWS GoFormation contains automatically generated Go structs for every CloudFormation/SAM resource, located in the [cloudformation/](cloudformation/) directory. These can be generated, from the latest [AWS CloudFormation Resource Specification](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html) published for `us-east-1` by just running `go generate`: ``` -type Resource interface { - Type() string - Properties() map[string]Property - ReturnValues() map[string]string -} +$ go generate + +Generated 587 AWS CloudFormation resources from specification v1.4.2 +Generated 17 AWS SAM resources from specification v2016-10-31 +Generated JSON Schema: schema/cloudformation.schema.json ``` -##### Property +Our aim is to automatically update GoFormation whenever the AWS CloudFormation Resource Specification changes, via an automated pull request to this repository. This is not currently in place. -type Property interface { - Value() interface{} - Original() interface{} - HasFn() bool -} +## Advanced -#### Resource-centric interfaces +### AWS CloudFormation Intrinsic Functions -While the template-specific interfaces give you enough capabilities for accessing all of your template's information, the way it does is somewhat generic, and sometimes you'd rather do some actions with certain specific kinds of resources. The resource-centric interfaces give you access to the resource's capabilities directly. +The following [AWS CloudFormation Intrinsic Functions](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) are supported in GoFormation: -Once your template is parsed, you can access any resource type with the function `template.GetResourcesByType("AWS::Resource::Name")`. During [post processing](#post-processing), every interpretable resource is casted to be compliant to its own interface. A simple type assertion would hence give you the capabilities described here: +- [x] [Fn::Base64](intrinsics/fnbase64.go) +- [x] [Fn::FindInMap](intrinsics/fnfindinmap.go) +- [x] [Fn::Join](intrinsics/fnjoin.go) +- [x] [Fn::Select](intrinsics/fnselect.go) +- [x] [Fn::Split](intrinsics/fnsplit.go) +- [x] [Fn::Sub](intrinsics/fnsub.go) +- [x] [Ref](intrinsics/ref.go) +- [ ] Fn::And +- [ ] Fn::Equals +- [ ] Fn::If +- [ ] Fn::Not +- [ ] Fn::Or +- [ ] Fn::GetAtt +- [ ] Fn::GetAZs +- [ ] Fn::ImportValue -##### AWSServerlessFunction +Any unsupported intrinsic functions will return `nil`. -`AWSServerlessFunction` is the resource that defines a `AWS::Serverless::Function` resources. Once you make the type assertion, you can leverage all of its parameters: +#### Resolving References (Ref) -``` -// Interface definition -type AWSServerlessFunction interface { - Handler() string - Runtime() string - CodeURI() AWSCommonStringOrS3Location - FunctionName() string - Description() string - MemorySize() int - Timeout() int - Role() interface{} - Policies() []string - EnvironmentVariables() map[string]string - Endpoints() ([]AWSServerlessFunctionEndpoint, error) -} -``` +The intrinsic 'Ref' function as implemented will resolve all of the [pseudo parameters](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html) such as `AWS::AccountId` with their default value as listed on [the bottom of this page](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html). -_EXAMPLE:_ +If a reference is not a pseudo parameter, GoFormation will try to resolve it within the AWS CloudFormation template. **Currently, this implementation only searches for `Parameters` with a name that matches the ref, and returns the `Default` if it has one.** -``` -... -// Use an AWSServerlessFunction -functions := template.GetResourcesByType("AWS::Serverless::Function") -for _, fn := range functions { - function := fn.(AWSServerlessFunction) -} -... +#### Warning: YAML short form intrinsic functions (e.g. !Sub) + +While this library supports both JSON and YAML AWS CloudFormation templates, it cannot handle short form intrinsic functions in YAML templates (e.g. `!Sub`). + +We will be adding support soon, however we need to patch Go's YAML library as it doesn't currently support tags. + +If you use a short form intrinsic function today, you'll either get the unresolved value (if the recieving field is a string field), or the template will fail to parse (if it's recieving field is a non-string field). + +## Contributing -``` \ No newline at end of file +Contributions and feedback are welcome! Proposals and pull requests will be considered and responded to. For more information, see the [CONTRIBUTING](CONTRIBUTING.md) file. diff --git a/vendor/github.com/awslabs/goformation/cloudformation/README.md b/vendor/github.com/awslabs/goformation/cloudformation/README.md new file mode 100644 index 0000000000..a1e31aab26 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/README.md @@ -0,0 +1,5 @@ +### Important + +All resource files in this directory are auto-generated by running 'go generate' in the repository root directory. + +Do not manually edit any of generated resource files \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-account.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-account.go new file mode 100644 index 0000000000..0326416cd7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-account.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayAccount AWS CloudFormation Resource (AWS::ApiGateway::Account) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-account.html +type AWSApiGatewayAccount struct { + + // CloudWatchRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-account.html#cfn-apigateway-account-cloudwatchrolearn + CloudWatchRoleArn string `json:"CloudWatchRoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayAccount) AWSCloudFormationType() string { + return "AWS::ApiGateway::Account" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayAccount) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayAccount) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayAccount + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayAccount) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayAccount + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayAccount(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayAccountResources retrieves all AWSApiGatewayAccount items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayAccountResources() map[string]AWSApiGatewayAccount { + results := map[string]AWSApiGatewayAccount{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayAccount: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Account" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayAccount + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayAccountWithName retrieves all AWSApiGatewayAccount items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayAccountWithName(name string) (AWSApiGatewayAccount, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayAccount: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Account" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayAccount + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayAccount{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-apikey.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-apikey.go new file mode 100644 index 0000000000..b2580468df --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-apikey.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayApiKey AWS CloudFormation Resource (AWS::ApiGateway::ApiKey) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html +type AWSApiGatewayApiKey struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apigateway-apikey-description + Description string `json:"Description,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apigateway-apikey-enabled + Enabled bool `json:"Enabled,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apigateway-apikey-name + Name string `json:"Name,omitempty"` + + // StageKeys AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apigateway-apikey-stagekeys + StageKeys []AWSApiGatewayApiKey_StageKey `json:"StageKeys,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayApiKey) AWSCloudFormationType() string { + return "AWS::ApiGateway::ApiKey" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayApiKey) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayApiKey) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayApiKey + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayApiKey) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayApiKey + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayApiKey(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayApiKeyResources retrieves all AWSApiGatewayApiKey items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayApiKeyResources() map[string]AWSApiGatewayApiKey { + results := map[string]AWSApiGatewayApiKey{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayApiKey: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::ApiKey" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayApiKey + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayApiKeyWithName retrieves all AWSApiGatewayApiKey items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayApiKeyWithName(name string) (AWSApiGatewayApiKey, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayApiKey: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::ApiKey" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayApiKey + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayApiKey{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-apikey_stagekey.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-apikey_stagekey.go new file mode 100644 index 0000000000..774655cdf6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-apikey_stagekey.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSApiGatewayApiKey_StageKey AWS CloudFormation Resource (AWS::ApiGateway::ApiKey.StageKey) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-apikey-stagekey.html +type AWSApiGatewayApiKey_StageKey struct { + + // RestApiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-apikey-stagekey.html#cfn-apigateway-apikey-stagekey-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // StageName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-apikey-stagekey.html#cfn-apigateway-apikey-stagekey-stagename + StageName string `json:"StageName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayApiKey_StageKey) AWSCloudFormationType() string { + return "AWS::ApiGateway::ApiKey.StageKey" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayApiKey_StageKey) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-authorizer.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-authorizer.go new file mode 100644 index 0000000000..37b9590405 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-authorizer.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayAuthorizer AWS CloudFormation Resource (AWS::ApiGateway::Authorizer) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html +type AWSApiGatewayAuthorizer struct { + + // AuthorizerCredentials AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-authorizercredentials + AuthorizerCredentials string `json:"AuthorizerCredentials,omitempty"` + + // AuthorizerResultTtlInSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-authorizerresultttlinseconds + AuthorizerResultTtlInSeconds int `json:"AuthorizerResultTtlInSeconds,omitempty"` + + // AuthorizerUri AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-authorizeruri + AuthorizerUri string `json:"AuthorizerUri,omitempty"` + + // IdentitySource AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-identitysource + IdentitySource string `json:"IdentitySource,omitempty"` + + // IdentityValidationExpression AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-identityvalidationexpression + IdentityValidationExpression string `json:"IdentityValidationExpression,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-name + Name string `json:"Name,omitempty"` + + // ProviderARNs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-providerarns + ProviderARNs []string `json:"ProviderARNs,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayAuthorizer) AWSCloudFormationType() string { + return "AWS::ApiGateway::Authorizer" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayAuthorizer) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayAuthorizer) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayAuthorizer + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayAuthorizer) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayAuthorizer + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayAuthorizer(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayAuthorizerResources retrieves all AWSApiGatewayAuthorizer items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayAuthorizerResources() map[string]AWSApiGatewayAuthorizer { + results := map[string]AWSApiGatewayAuthorizer{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayAuthorizer: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Authorizer" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayAuthorizer + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayAuthorizerWithName retrieves all AWSApiGatewayAuthorizer items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayAuthorizerWithName(name string) (AWSApiGatewayAuthorizer, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayAuthorizer: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Authorizer" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayAuthorizer + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayAuthorizer{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-basepathmapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-basepathmapping.go new file mode 100644 index 0000000000..ebf768735f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-basepathmapping.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayBasePathMapping AWS CloudFormation Resource (AWS::ApiGateway::BasePathMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-basepathmapping.html +type AWSApiGatewayBasePathMapping struct { + + // BasePath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-basepathmapping.html#cfn-apigateway-basepathmapping-basepath + BasePath string `json:"BasePath,omitempty"` + + // DomainName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-basepathmapping.html#cfn-apigateway-basepathmapping-domainname + DomainName string `json:"DomainName,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-basepathmapping.html#cfn-apigateway-basepathmapping-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // Stage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-basepathmapping.html#cfn-apigateway-basepathmapping-stage + Stage string `json:"Stage,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayBasePathMapping) AWSCloudFormationType() string { + return "AWS::ApiGateway::BasePathMapping" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayBasePathMapping) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayBasePathMapping) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayBasePathMapping + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayBasePathMapping) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayBasePathMapping + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayBasePathMapping(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayBasePathMappingResources retrieves all AWSApiGatewayBasePathMapping items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayBasePathMappingResources() map[string]AWSApiGatewayBasePathMapping { + results := map[string]AWSApiGatewayBasePathMapping{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayBasePathMapping: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::BasePathMapping" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayBasePathMapping + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayBasePathMappingWithName retrieves all AWSApiGatewayBasePathMapping items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayBasePathMappingWithName(name string) (AWSApiGatewayBasePathMapping, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayBasePathMapping: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::BasePathMapping" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayBasePathMapping + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayBasePathMapping{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-clientcertificate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-clientcertificate.go new file mode 100644 index 0000000000..550febf159 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-clientcertificate.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayClientCertificate AWS CloudFormation Resource (AWS::ApiGateway::ClientCertificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-clientcertificate.html +type AWSApiGatewayClientCertificate struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-clientcertificate.html#cfn-apigateway-clientcertificate-description + Description string `json:"Description,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayClientCertificate) AWSCloudFormationType() string { + return "AWS::ApiGateway::ClientCertificate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayClientCertificate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayClientCertificate) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayClientCertificate + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayClientCertificate) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayClientCertificate + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayClientCertificate(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayClientCertificateResources retrieves all AWSApiGatewayClientCertificate items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayClientCertificateResources() map[string]AWSApiGatewayClientCertificate { + results := map[string]AWSApiGatewayClientCertificate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayClientCertificate: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::ClientCertificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayClientCertificate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayClientCertificateWithName retrieves all AWSApiGatewayClientCertificate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayClientCertificateWithName(name string) (AWSApiGatewayClientCertificate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayClientCertificate: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::ClientCertificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayClientCertificate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayClientCertificate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment.go new file mode 100644 index 0000000000..cb7726acd4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayDeployment AWS CloudFormation Resource (AWS::ApiGateway::Deployment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-deployment.html +type AWSApiGatewayDeployment struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-deployment.html#cfn-apigateway-deployment-description + Description string `json:"Description,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-deployment.html#cfn-apigateway-deployment-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // StageDescription AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-deployment.html#cfn-apigateway-deployment-stagedescription + StageDescription *AWSApiGatewayDeployment_StageDescription `json:"StageDescription,omitempty"` + + // StageName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-deployment.html#cfn-apigateway-deployment-stagename + StageName string `json:"StageName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDeployment) AWSCloudFormationType() string { + return "AWS::ApiGateway::Deployment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayDeployment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayDeployment) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayDeployment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayDeployment) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayDeployment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayDeployment(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayDeploymentResources retrieves all AWSApiGatewayDeployment items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayDeploymentResources() map[string]AWSApiGatewayDeployment { + results := map[string]AWSApiGatewayDeployment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayDeployment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Deployment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayDeployment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayDeploymentWithName retrieves all AWSApiGatewayDeployment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayDeploymentWithName(name string) (AWSApiGatewayDeployment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayDeployment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Deployment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayDeployment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayDeployment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment_methodsetting.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment_methodsetting.go new file mode 100644 index 0000000000..b83e53671d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment_methodsetting.go @@ -0,0 +1,66 @@ +package cloudformation + +// AWSApiGatewayDeployment_MethodSetting AWS CloudFormation Resource (AWS::ApiGateway::Deployment.MethodSetting) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html +type AWSApiGatewayDeployment_MethodSetting struct { + + // CacheDataEncrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-cachedataencrypted + CacheDataEncrypted bool `json:"CacheDataEncrypted,omitempty"` + + // CacheTtlInSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-cachettlinseconds + CacheTtlInSeconds int `json:"CacheTtlInSeconds,omitempty"` + + // CachingEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-cachingenabled + CachingEnabled bool `json:"CachingEnabled,omitempty"` + + // DataTraceEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-datatraceenabled + DataTraceEnabled bool `json:"DataTraceEnabled,omitempty"` + + // HttpMethod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-httpmethod + HttpMethod string `json:"HttpMethod,omitempty"` + + // LoggingLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-logginglevel + LoggingLevel string `json:"LoggingLevel,omitempty"` + + // MetricsEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-metricsenabled + MetricsEnabled bool `json:"MetricsEnabled,omitempty"` + + // ResourcePath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-resourcepath + ResourcePath string `json:"ResourcePath,omitempty"` + + // ThrottlingBurstLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-throttlingburstlimit + ThrottlingBurstLimit int `json:"ThrottlingBurstLimit,omitempty"` + + // ThrottlingRateLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-throttlingratelimit + ThrottlingRateLimit float64 `json:"ThrottlingRateLimit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDeployment_MethodSetting) AWSCloudFormationType() string { + return "AWS::ApiGateway::Deployment.MethodSetting" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayDeployment_MethodSetting) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment_stagedescription.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment_stagedescription.go new file mode 100644 index 0000000000..2f9e9e3bac --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment_stagedescription.go @@ -0,0 +1,91 @@ +package cloudformation + +// AWSApiGatewayDeployment_StageDescription AWS CloudFormation Resource (AWS::ApiGateway::Deployment.StageDescription) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html +type AWSApiGatewayDeployment_StageDescription struct { + + // CacheClusterEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-cacheclusterenabled + CacheClusterEnabled bool `json:"CacheClusterEnabled,omitempty"` + + // CacheClusterSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-cacheclustersize + CacheClusterSize string `json:"CacheClusterSize,omitempty"` + + // CacheDataEncrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-cachedataencrypted + CacheDataEncrypted bool `json:"CacheDataEncrypted,omitempty"` + + // CacheTtlInSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-cachettlinseconds + CacheTtlInSeconds int `json:"CacheTtlInSeconds,omitempty"` + + // CachingEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-cachingenabled + CachingEnabled bool `json:"CachingEnabled,omitempty"` + + // ClientCertificateId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-clientcertificateid + ClientCertificateId string `json:"ClientCertificateId,omitempty"` + + // DataTraceEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-datatraceenabled + DataTraceEnabled bool `json:"DataTraceEnabled,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-description + Description string `json:"Description,omitempty"` + + // LoggingLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-logginglevel + LoggingLevel string `json:"LoggingLevel,omitempty"` + + // MethodSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-methodsettings + MethodSettings []AWSApiGatewayDeployment_MethodSetting `json:"MethodSettings,omitempty"` + + // MetricsEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-metricsenabled + MetricsEnabled bool `json:"MetricsEnabled,omitempty"` + + // StageName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-stagename + StageName string `json:"StageName,omitempty"` + + // ThrottlingBurstLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-throttlingburstlimit + ThrottlingBurstLimit int `json:"ThrottlingBurstLimit,omitempty"` + + // ThrottlingRateLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-throttlingratelimit + ThrottlingRateLimit float64 `json:"ThrottlingRateLimit,omitempty"` + + // Variables AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-variables + Variables map[string]string `json:"Variables,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDeployment_StageDescription) AWSCloudFormationType() string { + return "AWS::ApiGateway::Deployment.StageDescription" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayDeployment_StageDescription) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-domainname.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-domainname.go new file mode 100644 index 0000000000..f299ad3d5d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-domainname.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayDomainName AWS CloudFormation Resource (AWS::ApiGateway::DomainName) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html +type AWSApiGatewayDomainName struct { + + // CertificateArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-certificatearn + CertificateArn string `json:"CertificateArn,omitempty"` + + // DomainName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-domainname + DomainName string `json:"DomainName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDomainName) AWSCloudFormationType() string { + return "AWS::ApiGateway::DomainName" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayDomainName) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayDomainName) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayDomainName + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayDomainName) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayDomainName + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayDomainName(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayDomainNameResources retrieves all AWSApiGatewayDomainName items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayDomainNameResources() map[string]AWSApiGatewayDomainName { + results := map[string]AWSApiGatewayDomainName{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayDomainName: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::DomainName" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayDomainName + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayDomainNameWithName retrieves all AWSApiGatewayDomainName items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayDomainNameWithName(name string) (AWSApiGatewayDomainName, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayDomainName: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::DomainName" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayDomainName + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayDomainName{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method.go new file mode 100644 index 0000000000..e8cbb1a7fa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method.go @@ -0,0 +1,160 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayMethod AWS CloudFormation Resource (AWS::ApiGateway::Method) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html +type AWSApiGatewayMethod struct { + + // ApiKeyRequired AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-apikeyrequired + ApiKeyRequired bool `json:"ApiKeyRequired,omitempty"` + + // AuthorizationType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizationtype + AuthorizationType string `json:"AuthorizationType,omitempty"` + + // AuthorizerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizerid + AuthorizerId string `json:"AuthorizerId,omitempty"` + + // HttpMethod AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-httpmethod + HttpMethod string `json:"HttpMethod,omitempty"` + + // Integration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-integration + Integration *AWSApiGatewayMethod_Integration `json:"Integration,omitempty"` + + // MethodResponses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-methodresponses + MethodResponses []AWSApiGatewayMethod_MethodResponse `json:"MethodResponses,omitempty"` + + // RequestModels AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-requestmodels + RequestModels map[string]string `json:"RequestModels,omitempty"` + + // RequestParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-requestparameters + RequestParameters map[string]bool `json:"RequestParameters,omitempty"` + + // ResourceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-resourceid + ResourceId string `json:"ResourceId,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-restapiid + RestApiId string `json:"RestApiId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayMethod) AWSCloudFormationType() string { + return "AWS::ApiGateway::Method" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayMethod) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayMethod) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayMethod + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayMethod) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayMethod + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayMethod(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayMethodResources retrieves all AWSApiGatewayMethod items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayMethodResources() map[string]AWSApiGatewayMethod { + results := map[string]AWSApiGatewayMethod{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayMethod: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Method" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayMethod + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayMethodWithName retrieves all AWSApiGatewayMethod items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayMethodWithName(name string) (AWSApiGatewayMethod, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayMethod: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Method" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayMethod + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayMethod{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_integration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_integration.go new file mode 100644 index 0000000000..032a157cb7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_integration.go @@ -0,0 +1,66 @@ +package cloudformation + +// AWSApiGatewayMethod_Integration AWS CloudFormation Resource (AWS::ApiGateway::Method.Integration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html +type AWSApiGatewayMethod_Integration struct { + + // CacheKeyParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-cachekeyparameters + CacheKeyParameters []string `json:"CacheKeyParameters,omitempty"` + + // CacheNamespace AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-cachenamespace + CacheNamespace string `json:"CacheNamespace,omitempty"` + + // Credentials AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-credentials + Credentials string `json:"Credentials,omitempty"` + + // IntegrationHttpMethod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-integrationhttpmethod + IntegrationHttpMethod string `json:"IntegrationHttpMethod,omitempty"` + + // IntegrationResponses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-integrationresponses + IntegrationResponses []AWSApiGatewayMethod_IntegrationResponse `json:"IntegrationResponses,omitempty"` + + // PassthroughBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-passthroughbehavior + PassthroughBehavior string `json:"PassthroughBehavior,omitempty"` + + // RequestParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-requestparameters + RequestParameters map[string]string `json:"RequestParameters,omitempty"` + + // RequestTemplates AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-requesttemplates + RequestTemplates map[string]string `json:"RequestTemplates,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-type + Type string `json:"Type,omitempty"` + + // Uri AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-uri + Uri string `json:"Uri,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayMethod_Integration) AWSCloudFormationType() string { + return "AWS::ApiGateway::Method.Integration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayMethod_Integration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_integrationresponse.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_integrationresponse.go new file mode 100644 index 0000000000..447d426fb6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_integrationresponse.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSApiGatewayMethod_IntegrationResponse AWS CloudFormation Resource (AWS::ApiGateway::Method.IntegrationResponse) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html +type AWSApiGatewayMethod_IntegrationResponse struct { + + // ResponseParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integration-integrationresponse-responseparameters + ResponseParameters map[string]string `json:"ResponseParameters,omitempty"` + + // ResponseTemplates AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integration-integrationresponse-responsetemplates + ResponseTemplates map[string]string `json:"ResponseTemplates,omitempty"` + + // SelectionPattern AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integration-integrationresponse-selectionpattern + SelectionPattern string `json:"SelectionPattern,omitempty"` + + // StatusCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integration-integrationresponse-statuscode + StatusCode string `json:"StatusCode,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayMethod_IntegrationResponse) AWSCloudFormationType() string { + return "AWS::ApiGateway::Method.IntegrationResponse" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayMethod_IntegrationResponse) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_methodresponse.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_methodresponse.go new file mode 100644 index 0000000000..93f5e060a1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_methodresponse.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSApiGatewayMethod_MethodResponse AWS CloudFormation Resource (AWS::ApiGateway::Method.MethodResponse) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html +type AWSApiGatewayMethod_MethodResponse struct { + + // ResponseModels AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html#cfn-apigateway-method-methodresponse-responsemodels + ResponseModels map[string]string `json:"ResponseModels,omitempty"` + + // ResponseParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html#cfn-apigateway-method-methodresponse-responseparameters + ResponseParameters map[string]bool `json:"ResponseParameters,omitempty"` + + // StatusCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html#cfn-apigateway-method-methodresponse-statuscode + StatusCode string `json:"StatusCode,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayMethod_MethodResponse) AWSCloudFormationType() string { + return "AWS::ApiGateway::Method.MethodResponse" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayMethod_MethodResponse) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-model.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-model.go new file mode 100644 index 0000000000..7adce0cfeb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-model.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayModel AWS CloudFormation Resource (AWS::ApiGateway::Model) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-model.html +type AWSApiGatewayModel struct { + + // ContentType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-model.html#cfn-apigateway-model-contenttype + ContentType string `json:"ContentType,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-model.html#cfn-apigateway-model-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-model.html#cfn-apigateway-model-name + Name string `json:"Name,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-model.html#cfn-apigateway-model-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // Schema AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-model.html#cfn-apigateway-model-schema + Schema interface{} `json:"Schema,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayModel) AWSCloudFormationType() string { + return "AWS::ApiGateway::Model" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayModel) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayModel) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayModel + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayModel) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayModel + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayModel(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayModelResources retrieves all AWSApiGatewayModel items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayModelResources() map[string]AWSApiGatewayModel { + results := map[string]AWSApiGatewayModel{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayModel: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Model" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayModel + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayModelWithName retrieves all AWSApiGatewayModel items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayModelWithName(name string) (AWSApiGatewayModel, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayModel: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Model" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayModel + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayModel{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-resource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-resource.go new file mode 100644 index 0000000000..a0f08d2bb0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-resource.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayResource AWS CloudFormation Resource (AWS::ApiGateway::Resource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html +type AWSApiGatewayResource struct { + + // ParentId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html#cfn-apigateway-resource-parentid + ParentId string `json:"ParentId,omitempty"` + + // PathPart AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html#cfn-apigateway-resource-pathpart + PathPart string `json:"PathPart,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html#cfn-apigateway-resource-restapiid + RestApiId string `json:"RestApiId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayResource) AWSCloudFormationType() string { + return "AWS::ApiGateway::Resource" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayResource) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayResource) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayResource + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayResource) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayResource + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayResource(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayResourceResources retrieves all AWSApiGatewayResource items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayResourceResources() map[string]AWSApiGatewayResource { + results := map[string]AWSApiGatewayResource{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayResource: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Resource" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayResource + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayResourceWithName retrieves all AWSApiGatewayResource items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayResourceWithName(name string) (AWSApiGatewayResource, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayResource: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Resource" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayResource + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayResource{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi.go new file mode 100644 index 0000000000..0dff28e5cd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayRestApi AWS CloudFormation Resource (AWS::ApiGateway::RestApi) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html +type AWSApiGatewayRestApi struct { + + // BinaryMediaTypes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-binarymediatypes + BinaryMediaTypes []string `json:"BinaryMediaTypes,omitempty"` + + // Body AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-body + Body interface{} `json:"Body,omitempty"` + + // BodyS3Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-bodys3location + BodyS3Location *AWSApiGatewayRestApi_S3Location `json:"BodyS3Location,omitempty"` + + // CloneFrom AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-clonefrom + CloneFrom string `json:"CloneFrom,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-description + Description string `json:"Description,omitempty"` + + // FailOnWarnings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-failonwarnings + FailOnWarnings bool `json:"FailOnWarnings,omitempty"` + + // Mode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-mode + Mode string `json:"Mode,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-name + Name string `json:"Name,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-parameters + Parameters map[string]string `json:"Parameters,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayRestApi) AWSCloudFormationType() string { + return "AWS::ApiGateway::RestApi" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayRestApi) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayRestApi) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayRestApi + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayRestApi) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayRestApi + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayRestApi(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayRestApiResources retrieves all AWSApiGatewayRestApi items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayRestApiResources() map[string]AWSApiGatewayRestApi { + results := map[string]AWSApiGatewayRestApi{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayRestApi: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::RestApi" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayRestApi + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayRestApiWithName retrieves all AWSApiGatewayRestApi items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayRestApiWithName(name string) (AWSApiGatewayRestApi, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayRestApi: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::RestApi" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayRestApi + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayRestApi{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi_s3location.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi_s3location.go new file mode 100644 index 0000000000..1d01f4a1c8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi_s3location.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSApiGatewayRestApi_S3Location AWS CloudFormation Resource (AWS::ApiGateway::RestApi.S3Location) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-restapi-bodys3location.html +type AWSApiGatewayRestApi_S3Location struct { + + // Bucket AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-restapi-bodys3location.html#cfn-apigateway-restapi-s3location-bucket + Bucket string `json:"Bucket,omitempty"` + + // ETag AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-restapi-bodys3location.html#cfn-apigateway-restapi-s3location-etag + ETag string `json:"ETag,omitempty"` + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-restapi-bodys3location.html#cfn-apigateway-restapi-s3location-key + Key string `json:"Key,omitempty"` + + // Version AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-restapi-bodys3location.html#cfn-apigateway-restapi-s3location-version + Version string `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayRestApi_S3Location) AWSCloudFormationType() string { + return "AWS::ApiGateway::RestApi.S3Location" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayRestApi_S3Location) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-stage.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-stage.go new file mode 100644 index 0000000000..35405c646d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-stage.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayStage AWS CloudFormation Resource (AWS::ApiGateway::Stage) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html +type AWSApiGatewayStage struct { + + // CacheClusterEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-cacheclusterenabled + CacheClusterEnabled bool `json:"CacheClusterEnabled,omitempty"` + + // CacheClusterSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-cacheclustersize + CacheClusterSize string `json:"CacheClusterSize,omitempty"` + + // ClientCertificateId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-clientcertificateid + ClientCertificateId string `json:"ClientCertificateId,omitempty"` + + // DeploymentId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-deploymentid + DeploymentId string `json:"DeploymentId,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-description + Description string `json:"Description,omitempty"` + + // MethodSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-methodsettings + MethodSettings []AWSApiGatewayStage_MethodSetting `json:"MethodSettings,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // StageName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-stagename + StageName string `json:"StageName,omitempty"` + + // Variables AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-variables + Variables map[string]string `json:"Variables,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayStage) AWSCloudFormationType() string { + return "AWS::ApiGateway::Stage" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayStage) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayStage) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayStage + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayStage) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayStage + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayStage(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayStageResources retrieves all AWSApiGatewayStage items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayStageResources() map[string]AWSApiGatewayStage { + results := map[string]AWSApiGatewayStage{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayStage: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Stage" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayStage + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayStageWithName retrieves all AWSApiGatewayStage items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayStageWithName(name string) (AWSApiGatewayStage, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayStage: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::Stage" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayStage + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayStage{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-stage_methodsetting.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-stage_methodsetting.go new file mode 100644 index 0000000000..eac7a6c723 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-stage_methodsetting.go @@ -0,0 +1,66 @@ +package cloudformation + +// AWSApiGatewayStage_MethodSetting AWS CloudFormation Resource (AWS::ApiGateway::Stage.MethodSetting) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html +type AWSApiGatewayStage_MethodSetting struct { + + // CacheDataEncrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-cachedataencrypted + CacheDataEncrypted bool `json:"CacheDataEncrypted,omitempty"` + + // CacheTtlInSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-cachettlinseconds + CacheTtlInSeconds int `json:"CacheTtlInSeconds,omitempty"` + + // CachingEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-cachingenabled + CachingEnabled bool `json:"CachingEnabled,omitempty"` + + // DataTraceEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-datatraceenabled + DataTraceEnabled bool `json:"DataTraceEnabled,omitempty"` + + // HttpMethod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-httpmethod + HttpMethod string `json:"HttpMethod,omitempty"` + + // LoggingLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-logginglevel + LoggingLevel string `json:"LoggingLevel,omitempty"` + + // MetricsEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-metricsenabled + MetricsEnabled bool `json:"MetricsEnabled,omitempty"` + + // ResourcePath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-resourcepath + ResourcePath string `json:"ResourcePath,omitempty"` + + // ThrottlingBurstLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-throttlingburstlimit + ThrottlingBurstLimit int `json:"ThrottlingBurstLimit,omitempty"` + + // ThrottlingRateLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-throttlingratelimit + ThrottlingRateLimit float64 `json:"ThrottlingRateLimit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayStage_MethodSetting) AWSCloudFormationType() string { + return "AWS::ApiGateway::Stage.MethodSetting" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayStage_MethodSetting) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan.go new file mode 100644 index 0000000000..3c59f020e0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayUsagePlan AWS CloudFormation Resource (AWS::ApiGateway::UsagePlan) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html +type AWSApiGatewayUsagePlan struct { + + // ApiStages AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-apistages + ApiStages []AWSApiGatewayUsagePlan_ApiStage `json:"ApiStages,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-description + Description string `json:"Description,omitempty"` + + // Quota AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-quota + Quota *AWSApiGatewayUsagePlan_QuotaSettings `json:"Quota,omitempty"` + + // Throttle AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-throttle + Throttle *AWSApiGatewayUsagePlan_ThrottleSettings `json:"Throttle,omitempty"` + + // UsagePlanName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-usageplanname + UsagePlanName string `json:"UsagePlanName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlan) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlan" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayUsagePlan) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayUsagePlan) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayUsagePlan + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayUsagePlan) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayUsagePlan + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayUsagePlan(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayUsagePlanResources retrieves all AWSApiGatewayUsagePlan items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayUsagePlanResources() map[string]AWSApiGatewayUsagePlan { + results := map[string]AWSApiGatewayUsagePlan{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayUsagePlan: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::UsagePlan" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayUsagePlan + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayUsagePlanWithName retrieves all AWSApiGatewayUsagePlan items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayUsagePlanWithName(name string) (AWSApiGatewayUsagePlan, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayUsagePlan: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::UsagePlan" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayUsagePlan + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayUsagePlan{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_apistage.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_apistage.go new file mode 100644 index 0000000000..8e9d231c46 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_apistage.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSApiGatewayUsagePlan_ApiStage AWS CloudFormation Resource (AWS::ApiGateway::UsagePlan.ApiStage) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-apistage.html +type AWSApiGatewayUsagePlan_ApiStage struct { + + // ApiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-apistage.html#cfn-apigateway-usageplan-apistage-apiid + ApiId string `json:"ApiId,omitempty"` + + // Stage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-apistage.html#cfn-apigateway-usageplan-apistage-stage + Stage string `json:"Stage,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlan_ApiStage) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlan.ApiStage" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayUsagePlan_ApiStage) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_quotasettings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_quotasettings.go new file mode 100644 index 0000000000..2b867d39cc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_quotasettings.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSApiGatewayUsagePlan_QuotaSettings AWS CloudFormation Resource (AWS::ApiGateway::UsagePlan.QuotaSettings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-quotasettings.html +type AWSApiGatewayUsagePlan_QuotaSettings struct { + + // Limit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-quotasettings.html#cfn-apigateway-usageplan-quotasettings-limit + Limit int `json:"Limit,omitempty"` + + // Offset AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-quotasettings.html#cfn-apigateway-usageplan-quotasettings-offset + Offset int `json:"Offset,omitempty"` + + // Period AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-quotasettings.html#cfn-apigateway-usageplan-quotasettings-period + Period string `json:"Period,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlan_QuotaSettings) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlan.QuotaSettings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayUsagePlan_QuotaSettings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_throttlesettings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_throttlesettings.go new file mode 100644 index 0000000000..bd548894fa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_throttlesettings.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSApiGatewayUsagePlan_ThrottleSettings AWS CloudFormation Resource (AWS::ApiGateway::UsagePlan.ThrottleSettings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-throttlesettings.html +type AWSApiGatewayUsagePlan_ThrottleSettings struct { + + // BurstLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-throttlesettings.html#cfn-apigateway-usageplan-throttlesettings-burstlimit + BurstLimit int `json:"BurstLimit,omitempty"` + + // RateLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-usageplan-throttlesettings.html#cfn-apigateway-usageplan-throttlesettings-ratelimit + RateLimit float64 `json:"RateLimit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlan_ThrottleSettings) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlan.ThrottleSettings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayUsagePlan_ThrottleSettings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplankey.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplankey.go new file mode 100644 index 0000000000..de1f6155a4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplankey.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayUsagePlanKey AWS CloudFormation Resource (AWS::ApiGateway::UsagePlanKey) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html +type AWSApiGatewayUsagePlanKey struct { + + // KeyId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html#cfn-apigateway-usageplankey-keyid + KeyId string `json:"KeyId,omitempty"` + + // KeyType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html#cfn-apigateway-usageplankey-keytype + KeyType string `json:"KeyType,omitempty"` + + // UsagePlanId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html#cfn-apigateway-usageplankey-usageplanid + UsagePlanId string `json:"UsagePlanId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlanKey) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlanKey" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApiGatewayUsagePlanKey) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApiGatewayUsagePlanKey) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayUsagePlanKey + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayUsagePlanKey) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayUsagePlanKey + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApiGatewayUsagePlanKey(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayUsagePlanKeyResources retrieves all AWSApiGatewayUsagePlanKey items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayUsagePlanKeyResources() map[string]AWSApiGatewayUsagePlanKey { + results := map[string]AWSApiGatewayUsagePlanKey{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayUsagePlanKey: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::UsagePlanKey" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayUsagePlanKey + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayUsagePlanKeyWithName retrieves all AWSApiGatewayUsagePlanKey items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayUsagePlanKeyWithName(name string) (AWSApiGatewayUsagePlanKey, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayUsagePlanKey: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApiGateway::UsagePlanKey" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayUsagePlanKey + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayUsagePlanKey{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget.go new file mode 100644 index 0000000000..be7678f088 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApplicationAutoScalingScalableTarget AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalableTarget) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html +type AWSApplicationAutoScalingScalableTarget struct { + + // MaxCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html#cfn-applicationautoscaling-scalabletarget-maxcapacity + MaxCapacity int `json:"MaxCapacity,omitempty"` + + // MinCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html#cfn-applicationautoscaling-scalabletarget-mincapacity + MinCapacity int `json:"MinCapacity,omitempty"` + + // ResourceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html#cfn-applicationautoscaling-scalabletarget-resourceid + ResourceId string `json:"ResourceId,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html#cfn-applicationautoscaling-scalabletarget-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // ScalableDimension AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html#cfn-applicationautoscaling-scalabletarget-scalabledimension + ScalableDimension string `json:"ScalableDimension,omitempty"` + + // ServiceNamespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html#cfn-applicationautoscaling-scalabletarget-servicenamespace + ServiceNamespace string `json:"ServiceNamespace,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalableTarget) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalableTarget" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApplicationAutoScalingScalableTarget) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApplicationAutoScalingScalableTarget) MarshalJSON() ([]byte, error) { + type Properties AWSApplicationAutoScalingScalableTarget + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApplicationAutoScalingScalableTarget) UnmarshalJSON(b []byte) error { + type Properties AWSApplicationAutoScalingScalableTarget + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApplicationAutoScalingScalableTarget(*res.Properties) + } + + return nil +} + +// GetAllAWSApplicationAutoScalingScalableTargetResources retrieves all AWSApplicationAutoScalingScalableTarget items from an AWS CloudFormation template +func (t *Template) GetAllAWSApplicationAutoScalingScalableTargetResources() map[string]AWSApplicationAutoScalingScalableTarget { + results := map[string]AWSApplicationAutoScalingScalableTarget{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApplicationAutoScalingScalableTarget: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApplicationAutoScaling::ScalableTarget" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApplicationAutoScalingScalableTarget + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApplicationAutoScalingScalableTargetWithName retrieves all AWSApplicationAutoScalingScalableTarget items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApplicationAutoScalingScalableTargetWithName(name string) (AWSApplicationAutoScalingScalableTarget, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApplicationAutoScalingScalableTarget: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApplicationAutoScaling::ScalableTarget" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApplicationAutoScalingScalableTarget + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApplicationAutoScalingScalableTarget{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy.go new file mode 100644 index 0000000000..a5fb62d583 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy.go @@ -0,0 +1,150 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApplicationAutoScalingScalingPolicy AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalingPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html +type AWSApplicationAutoScalingScalingPolicy struct { + + // PolicyName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-policyname + PolicyName string `json:"PolicyName,omitempty"` + + // PolicyType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-policytype + PolicyType string `json:"PolicyType,omitempty"` + + // ResourceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-resourceid + ResourceId string `json:"ResourceId,omitempty"` + + // ScalableDimension AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-scalabledimension + ScalableDimension string `json:"ScalableDimension,omitempty"` + + // ScalingTargetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-scalingtargetid + ScalingTargetId string `json:"ScalingTargetId,omitempty"` + + // ServiceNamespace AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-servicenamespace + ServiceNamespace string `json:"ServiceNamespace,omitempty"` + + // StepScalingPolicyConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration + StepScalingPolicyConfiguration *AWSApplicationAutoScalingScalingPolicy_StepScalingPolicyConfiguration `json:"StepScalingPolicyConfiguration,omitempty"` + + // TargetTrackingScalingPolicyConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration + TargetTrackingScalingPolicyConfiguration *AWSApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration `json:"TargetTrackingScalingPolicyConfiguration,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApplicationAutoScalingScalingPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSApplicationAutoScalingScalingPolicy) MarshalJSON() ([]byte, error) { + type Properties AWSApplicationAutoScalingScalingPolicy + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApplicationAutoScalingScalingPolicy) UnmarshalJSON(b []byte) error { + type Properties AWSApplicationAutoScalingScalingPolicy + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSApplicationAutoScalingScalingPolicy(*res.Properties) + } + + return nil +} + +// GetAllAWSApplicationAutoScalingScalingPolicyResources retrieves all AWSApplicationAutoScalingScalingPolicy items from an AWS CloudFormation template +func (t *Template) GetAllAWSApplicationAutoScalingScalingPolicyResources() map[string]AWSApplicationAutoScalingScalingPolicy { + results := map[string]AWSApplicationAutoScalingScalingPolicy{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApplicationAutoScalingScalingPolicy: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApplicationAutoScaling::ScalingPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApplicationAutoScalingScalingPolicy + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApplicationAutoScalingScalingPolicyWithName retrieves all AWSApplicationAutoScalingScalingPolicy items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApplicationAutoScalingScalingPolicyWithName(name string) (AWSApplicationAutoScalingScalingPolicy, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApplicationAutoScalingScalingPolicy: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ApplicationAutoScaling::ScalingPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApplicationAutoScalingScalingPolicy + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApplicationAutoScalingScalingPolicy{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_customizedmetricspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_customizedmetricspecification.go new file mode 100644 index 0000000000..b3197474be --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_customizedmetricspecification.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSApplicationAutoScalingScalingPolicy_CustomizedMetricSpecification AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalingPolicy.CustomizedMetricSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-customizedmetricspecification.html +type AWSApplicationAutoScalingScalingPolicy_CustomizedMetricSpecification struct { + + // Dimensions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-customizedmetricspecification.html#cfn-applicationautoscaling-scalingpolicy-customizedmetricspecification-dimensions + Dimensions []AWSApplicationAutoScalingScalingPolicy_MetricDimension `json:"Dimensions,omitempty"` + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-customizedmetricspecification.html#cfn-applicationautoscaling-scalingpolicy-customizedmetricspecification-metricname + MetricName string `json:"MetricName,omitempty"` + + // Namespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-customizedmetricspecification.html#cfn-applicationautoscaling-scalingpolicy-customizedmetricspecification-namespace + Namespace string `json:"Namespace,omitempty"` + + // Statistic AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-customizedmetricspecification.html#cfn-applicationautoscaling-scalingpolicy-customizedmetricspecification-statistic + Statistic string `json:"Statistic,omitempty"` + + // Unit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-customizedmetricspecification.html#cfn-applicationautoscaling-scalingpolicy-customizedmetricspecification-unit + Unit string `json:"Unit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_CustomizedMetricSpecification) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.CustomizedMetricSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApplicationAutoScalingScalingPolicy_CustomizedMetricSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_metricdimension.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_metricdimension.go new file mode 100644 index 0000000000..6a426b1028 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_metricdimension.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSApplicationAutoScalingScalingPolicy_MetricDimension AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalingPolicy.MetricDimension) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-metricdimension.html +type AWSApplicationAutoScalingScalingPolicy_MetricDimension struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-metricdimension.html#cfn-applicationautoscaling-scalingpolicy-metricdimension-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-metricdimension.html#cfn-applicationautoscaling-scalingpolicy-metricdimension-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_MetricDimension) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.MetricDimension" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApplicationAutoScalingScalingPolicy_MetricDimension) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_predefinedmetricspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_predefinedmetricspecification.go new file mode 100644 index 0000000000..703f7684a7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_predefinedmetricspecification.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalingPolicy.PredefinedMetricSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-predefinedmetricspecification.html +type AWSApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification struct { + + // PredefinedMetricType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-predefinedmetricspecification.html#cfn-applicationautoscaling-scalingpolicy-predefinedmetricspecification-predefinedmetrictype + PredefinedMetricType string `json:"PredefinedMetricType,omitempty"` + + // ResourceLabel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-predefinedmetricspecification.html#cfn-applicationautoscaling-scalingpolicy-predefinedmetricspecification-resourcelabel + ResourceLabel string `json:"ResourceLabel,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.PredefinedMetricSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_stepadjustment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_stepadjustment.go new file mode 100644 index 0000000000..ca41bedc27 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_stepadjustment.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSApplicationAutoScalingScalingPolicy_StepAdjustment AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalingPolicy.StepAdjustment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-stepadjustment.html +type AWSApplicationAutoScalingScalingPolicy_StepAdjustment struct { + + // MetricIntervalLowerBound AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-stepadjustment.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-stepadjustment-metricintervallowerbound + MetricIntervalLowerBound float64 `json:"MetricIntervalLowerBound,omitempty"` + + // MetricIntervalUpperBound AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-stepadjustment.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-stepadjustment-metricintervalupperbound + MetricIntervalUpperBound float64 `json:"MetricIntervalUpperBound,omitempty"` + + // ScalingAdjustment AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-stepadjustment.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-stepadjustment-scalingadjustment + ScalingAdjustment int `json:"ScalingAdjustment,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_StepAdjustment) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.StepAdjustment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApplicationAutoScalingScalingPolicy_StepAdjustment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_stepscalingpolicyconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_stepscalingpolicyconfiguration.go new file mode 100644 index 0000000000..c63387ab04 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_stepscalingpolicyconfiguration.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSApplicationAutoScalingScalingPolicy_StepScalingPolicyConfiguration AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalingPolicy.StepScalingPolicyConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration.html +type AWSApplicationAutoScalingScalingPolicy_StepScalingPolicyConfiguration struct { + + // AdjustmentType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-adjustmenttype + AdjustmentType string `json:"AdjustmentType,omitempty"` + + // Cooldown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-cooldown + Cooldown int `json:"Cooldown,omitempty"` + + // MetricAggregationType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-metricaggregationtype + MetricAggregationType string `json:"MetricAggregationType,omitempty"` + + // MinAdjustmentMagnitude AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-minadjustmentmagnitude + MinAdjustmentMagnitude int `json:"MinAdjustmentMagnitude,omitempty"` + + // StepAdjustments AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-stepscalingpolicyconfiguration-stepadjustments + StepAdjustments []AWSApplicationAutoScalingScalingPolicy_StepAdjustment `json:"StepAdjustments,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_StepScalingPolicyConfiguration) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.StepScalingPolicyConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApplicationAutoScalingScalingPolicy_StepScalingPolicyConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_targettrackingscalingpolicyconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_targettrackingscalingpolicyconfiguration.go new file mode 100644 index 0000000000..4a2420daa1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_targettrackingscalingpolicyconfiguration.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalingPolicy.TargetTrackingScalingPolicyConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration.html +type AWSApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration struct { + + // CustomizedMetricSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration-customizedmetricspecification + CustomizedMetricSpecification *AWSApplicationAutoScalingScalingPolicy_CustomizedMetricSpecification `json:"CustomizedMetricSpecification,omitempty"` + + // PredefinedMetricSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration-predefinedmetricspecification + PredefinedMetricSpecification *AWSApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification `json:"PredefinedMetricSpecification,omitempty"` + + // ScaleInCooldown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration-scaleincooldown + ScaleInCooldown int `json:"ScaleInCooldown,omitempty"` + + // ScaleOutCooldown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration-scaleoutcooldown + ScaleOutCooldown int `json:"ScaleOutCooldown,omitempty"` + + // TargetValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration-targetvalue + TargetValue float64 `json:"TargetValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.TargetTrackingScalingPolicyConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup.go new file mode 100644 index 0000000000..0c0d6e4490 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup.go @@ -0,0 +1,195 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAutoScalingAutoScalingGroup AWS CloudFormation Resource (AWS::AutoScaling::AutoScalingGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html +type AWSAutoScalingAutoScalingGroup struct { + + // AvailabilityZones AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-availabilityzones + AvailabilityZones []string `json:"AvailabilityZones,omitempty"` + + // Cooldown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-cooldown + Cooldown string `json:"Cooldown,omitempty"` + + // DesiredCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-desiredcapacity + DesiredCapacity string `json:"DesiredCapacity,omitempty"` + + // HealthCheckGracePeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-healthcheckgraceperiod + HealthCheckGracePeriod int `json:"HealthCheckGracePeriod,omitempty"` + + // HealthCheckType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-healthchecktype + HealthCheckType string `json:"HealthCheckType,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-instanceid + InstanceId string `json:"InstanceId,omitempty"` + + // LaunchConfigurationName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-launchconfigurationname + LaunchConfigurationName string `json:"LaunchConfigurationName,omitempty"` + + // LoadBalancerNames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-loadbalancernames + LoadBalancerNames []string `json:"LoadBalancerNames,omitempty"` + + // MaxSize AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-maxsize + MaxSize string `json:"MaxSize,omitempty"` + + // MetricsCollection AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-metricscollection + MetricsCollection []AWSAutoScalingAutoScalingGroup_MetricsCollection `json:"MetricsCollection,omitempty"` + + // MinSize AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-minsize + MinSize string `json:"MinSize,omitempty"` + + // NotificationConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-notificationconfigurations + NotificationConfigurations []AWSAutoScalingAutoScalingGroup_NotificationConfiguration `json:"NotificationConfigurations,omitempty"` + + // PlacementGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-placementgroup + PlacementGroup string `json:"PlacementGroup,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-tags + Tags []AWSAutoScalingAutoScalingGroup_TagProperty `json:"Tags,omitempty"` + + // TargetGroupARNs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-targetgrouparns + TargetGroupARNs []string `json:"TargetGroupARNs,omitempty"` + + // TerminationPolicies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-termpolicy + TerminationPolicies []string `json:"TerminationPolicies,omitempty"` + + // VPCZoneIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-vpczoneidentifier + VPCZoneIdentifier []string `json:"VPCZoneIdentifier,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingAutoScalingGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSAutoScalingAutoScalingGroup) MarshalJSON() ([]byte, error) { + type Properties AWSAutoScalingAutoScalingGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAutoScalingAutoScalingGroup) UnmarshalJSON(b []byte) error { + type Properties AWSAutoScalingAutoScalingGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSAutoScalingAutoScalingGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSAutoScalingAutoScalingGroupResources retrieves all AWSAutoScalingAutoScalingGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSAutoScalingAutoScalingGroupResources() map[string]AWSAutoScalingAutoScalingGroup { + results := map[string]AWSAutoScalingAutoScalingGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAutoScalingAutoScalingGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::AutoScalingGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingAutoScalingGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAutoScalingAutoScalingGroupWithName retrieves all AWSAutoScalingAutoScalingGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAutoScalingAutoScalingGroupWithName(name string) (AWSAutoScalingAutoScalingGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAutoScalingAutoScalingGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::AutoScalingGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingAutoScalingGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAutoScalingAutoScalingGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_metricscollection.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_metricscollection.go new file mode 100644 index 0000000000..c89c0a76e0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_metricscollection.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSAutoScalingAutoScalingGroup_MetricsCollection AWS CloudFormation Resource (AWS::AutoScaling::AutoScalingGroup.MetricsCollection) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-metricscollection.html +type AWSAutoScalingAutoScalingGroup_MetricsCollection struct { + + // Granularity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-metricscollection.html#cfn-as-metricscollection-granularity + Granularity string `json:"Granularity,omitempty"` + + // Metrics AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-metricscollection.html#cfn-as-metricscollection-metrics + Metrics []string `json:"Metrics,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup_MetricsCollection) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup.MetricsCollection" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingAutoScalingGroup_MetricsCollection) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_notificationconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_notificationconfiguration.go new file mode 100644 index 0000000000..209278e6bf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_notificationconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSAutoScalingAutoScalingGroup_NotificationConfiguration AWS CloudFormation Resource (AWS::AutoScaling::AutoScalingGroup.NotificationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-notificationconfigurations.html +type AWSAutoScalingAutoScalingGroup_NotificationConfiguration struct { + + // NotificationTypes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-notificationconfigurations.html#cfn-as-group-notificationconfigurations-notificationtypes + NotificationTypes []string `json:"NotificationTypes,omitempty"` + + // TopicARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-notificationconfigurations.html#cfn-autoscaling-autoscalinggroup-notificationconfigurations-topicarn + TopicARN string `json:"TopicARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup_NotificationConfiguration) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup.NotificationConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingAutoScalingGroup_NotificationConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_tagproperty.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_tagproperty.go new file mode 100644 index 0000000000..6f90c841aa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_tagproperty.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSAutoScalingAutoScalingGroup_TagProperty AWS CloudFormation Resource (AWS::AutoScaling::AutoScalingGroup.TagProperty) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-tags.html +type AWSAutoScalingAutoScalingGroup_TagProperty struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-tags.html#cfn-as-tags-Key + Key string `json:"Key,omitempty"` + + // PropagateAtLaunch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-tags.html#cfn-as-tags-PropagateAtLaunch + PropagateAtLaunch bool `json:"PropagateAtLaunch,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-tags.html#cfn-as-tags-Value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup_TagProperty) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup.TagProperty" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingAutoScalingGroup_TagProperty) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration.go new file mode 100644 index 0000000000..b9fba5bdf6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration.go @@ -0,0 +1,195 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAutoScalingLaunchConfiguration AWS CloudFormation Resource (AWS::AutoScaling::LaunchConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html +type AWSAutoScalingLaunchConfiguration struct { + + // AssociatePublicIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cf-as-launchconfig-associatepubip + AssociatePublicIpAddress bool `json:"AssociatePublicIpAddress,omitempty"` + + // BlockDeviceMappings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-blockdevicemappings + BlockDeviceMappings []AWSAutoScalingLaunchConfiguration_BlockDeviceMapping `json:"BlockDeviceMappings,omitempty"` + + // ClassicLinkVPCId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-classiclinkvpcid + ClassicLinkVPCId string `json:"ClassicLinkVPCId,omitempty"` + + // ClassicLinkVPCSecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-classiclinkvpcsecuritygroups + ClassicLinkVPCSecurityGroups []string `json:"ClassicLinkVPCSecurityGroups,omitempty"` + + // EbsOptimized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` + + // IamInstanceProfile AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-iaminstanceprofile + IamInstanceProfile string `json:"IamInstanceProfile,omitempty"` + + // ImageId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-imageid + ImageId string `json:"ImageId,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-instanceid + InstanceId string `json:"InstanceId,omitempty"` + + // InstanceMonitoring AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-instancemonitoring + InstanceMonitoring bool `json:"InstanceMonitoring,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // KernelId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-kernelid + KernelId string `json:"KernelId,omitempty"` + + // KeyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-keyname + KeyName string `json:"KeyName,omitempty"` + + // PlacementTenancy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-placementtenancy + PlacementTenancy string `json:"PlacementTenancy,omitempty"` + + // RamDiskId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-ramdiskid + RamDiskId string `json:"RamDiskId,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-securitygroups + SecurityGroups []string `json:"SecurityGroups,omitempty"` + + // SpotPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-spotprice + SpotPrice string `json:"SpotPrice,omitempty"` + + // UserData AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-as-launchconfig-userdata + UserData string `json:"UserData,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingLaunchConfiguration) AWSCloudFormationType() string { + return "AWS::AutoScaling::LaunchConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingLaunchConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSAutoScalingLaunchConfiguration) MarshalJSON() ([]byte, error) { + type Properties AWSAutoScalingLaunchConfiguration + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAutoScalingLaunchConfiguration) UnmarshalJSON(b []byte) error { + type Properties AWSAutoScalingLaunchConfiguration + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSAutoScalingLaunchConfiguration(*res.Properties) + } + + return nil +} + +// GetAllAWSAutoScalingLaunchConfigurationResources retrieves all AWSAutoScalingLaunchConfiguration items from an AWS CloudFormation template +func (t *Template) GetAllAWSAutoScalingLaunchConfigurationResources() map[string]AWSAutoScalingLaunchConfiguration { + results := map[string]AWSAutoScalingLaunchConfiguration{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAutoScalingLaunchConfiguration: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::LaunchConfiguration" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingLaunchConfiguration + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAutoScalingLaunchConfigurationWithName retrieves all AWSAutoScalingLaunchConfiguration items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAutoScalingLaunchConfigurationWithName(name string) (AWSAutoScalingLaunchConfiguration, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAutoScalingLaunchConfiguration: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::LaunchConfiguration" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingLaunchConfiguration + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAutoScalingLaunchConfiguration{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration_blockdevice.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration_blockdevice.go new file mode 100644 index 0000000000..1853329be3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration_blockdevice.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSAutoScalingLaunchConfiguration_BlockDevice AWS CloudFormation Resource (AWS::AutoScaling::LaunchConfiguration.BlockDevice) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-template.html +type AWSAutoScalingLaunchConfiguration_BlockDevice struct { + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-template.html#cfn-as-launchconfig-blockdev-template-deleteonterm + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // Encrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-template.html#cfn-as-launchconfig-blockdev-template-encrypted + Encrypted bool `json:"Encrypted,omitempty"` + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-template.html#cfn-as-launchconfig-blockdev-template-iops + Iops int `json:"Iops,omitempty"` + + // SnapshotId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-template.html#cfn-as-launchconfig-blockdev-template-snapshotid + SnapshotId string `json:"SnapshotId,omitempty"` + + // VolumeSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-template.html#cfn-as-launchconfig-blockdev-template-volumesize + VolumeSize int `json:"VolumeSize,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-template.html#cfn-as-launchconfig-blockdev-template-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingLaunchConfiguration_BlockDevice) AWSCloudFormationType() string { + return "AWS::AutoScaling::LaunchConfiguration.BlockDevice" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingLaunchConfiguration_BlockDevice) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration_blockdevicemapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration_blockdevicemapping.go new file mode 100644 index 0000000000..239fa92bc4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration_blockdevicemapping.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSAutoScalingLaunchConfiguration_BlockDeviceMapping AWS CloudFormation Resource (AWS::AutoScaling::LaunchConfiguration.BlockDeviceMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-mapping.html +type AWSAutoScalingLaunchConfiguration_BlockDeviceMapping struct { + + // DeviceName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-mapping.html#cfn-as-launchconfig-blockdev-mapping-devicename + DeviceName string `json:"DeviceName,omitempty"` + + // Ebs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-mapping.html#cfn-as-launchconfig-blockdev-mapping-ebs + Ebs *AWSAutoScalingLaunchConfiguration_BlockDevice `json:"Ebs,omitempty"` + + // NoDevice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-mapping.html#cfn-as-launchconfig-blockdev-mapping-nodevice + NoDevice bool `json:"NoDevice,omitempty"` + + // VirtualName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-mapping.html#cfn-as-launchconfig-blockdev-mapping-virtualname + VirtualName string `json:"VirtualName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingLaunchConfiguration_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::AutoScaling::LaunchConfiguration.BlockDeviceMapping" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingLaunchConfiguration_BlockDeviceMapping) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-lifecyclehook.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-lifecyclehook.go new file mode 100644 index 0000000000..cd62559ab6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-lifecyclehook.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAutoScalingLifecycleHook AWS CloudFormation Resource (AWS::AutoScaling::LifecycleHook) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html +type AWSAutoScalingLifecycleHook struct { + + // AutoScalingGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#cfn-as-lifecyclehook-autoscalinggroupname + AutoScalingGroupName string `json:"AutoScalingGroupName,omitempty"` + + // DefaultResult AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#cfn-as-lifecyclehook-defaultresult + DefaultResult string `json:"DefaultResult,omitempty"` + + // HeartbeatTimeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#cfn-as-lifecyclehook-heartbeattimeout + HeartbeatTimeout int `json:"HeartbeatTimeout,omitempty"` + + // LifecycleTransition AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#cfn-as-lifecyclehook-lifecycletransition + LifecycleTransition string `json:"LifecycleTransition,omitempty"` + + // NotificationMetadata AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#cfn-as-lifecyclehook-notificationmetadata + NotificationMetadata string `json:"NotificationMetadata,omitempty"` + + // NotificationTargetARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#cfn-as-lifecyclehook-notificationtargetarn + NotificationTargetARN string `json:"NotificationTargetARN,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#cfn-as-lifecyclehook-rolearn + RoleARN string `json:"RoleARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingLifecycleHook) AWSCloudFormationType() string { + return "AWS::AutoScaling::LifecycleHook" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingLifecycleHook) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSAutoScalingLifecycleHook) MarshalJSON() ([]byte, error) { + type Properties AWSAutoScalingLifecycleHook + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAutoScalingLifecycleHook) UnmarshalJSON(b []byte) error { + type Properties AWSAutoScalingLifecycleHook + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSAutoScalingLifecycleHook(*res.Properties) + } + + return nil +} + +// GetAllAWSAutoScalingLifecycleHookResources retrieves all AWSAutoScalingLifecycleHook items from an AWS CloudFormation template +func (t *Template) GetAllAWSAutoScalingLifecycleHookResources() map[string]AWSAutoScalingLifecycleHook { + results := map[string]AWSAutoScalingLifecycleHook{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAutoScalingLifecycleHook: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::LifecycleHook" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingLifecycleHook + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAutoScalingLifecycleHookWithName retrieves all AWSAutoScalingLifecycleHook items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAutoScalingLifecycleHookWithName(name string) (AWSAutoScalingLifecycleHook, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAutoScalingLifecycleHook: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::LifecycleHook" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingLifecycleHook + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAutoScalingLifecycleHook{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy.go new file mode 100644 index 0000000000..e429e00bf6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAutoScalingScalingPolicy AWS CloudFormation Resource (AWS::AutoScaling::ScalingPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html +type AWSAutoScalingScalingPolicy struct { + + // AdjustmentType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-adjustmenttype + AdjustmentType string `json:"AdjustmentType,omitempty"` + + // AutoScalingGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-autoscalinggroupname + AutoScalingGroupName string `json:"AutoScalingGroupName,omitempty"` + + // Cooldown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-cooldown + Cooldown string `json:"Cooldown,omitempty"` + + // EstimatedInstanceWarmup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-estimatedinstancewarmup + EstimatedInstanceWarmup int `json:"EstimatedInstanceWarmup,omitempty"` + + // MetricAggregationType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-metricaggregationtype + MetricAggregationType string `json:"MetricAggregationType,omitempty"` + + // MinAdjustmentMagnitude AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-minadjustmentmagnitude + MinAdjustmentMagnitude int `json:"MinAdjustmentMagnitude,omitempty"` + + // PolicyType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-policytype + PolicyType string `json:"PolicyType,omitempty"` + + // ScalingAdjustment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-scalingadjustment + ScalingAdjustment int `json:"ScalingAdjustment,omitempty"` + + // StepAdjustments AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-stepadjustments + StepAdjustments []AWSAutoScalingScalingPolicy_StepAdjustment `json:"StepAdjustments,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScalingPolicy) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScalingPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingScalingPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSAutoScalingScalingPolicy) MarshalJSON() ([]byte, error) { + type Properties AWSAutoScalingScalingPolicy + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAutoScalingScalingPolicy) UnmarshalJSON(b []byte) error { + type Properties AWSAutoScalingScalingPolicy + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSAutoScalingScalingPolicy(*res.Properties) + } + + return nil +} + +// GetAllAWSAutoScalingScalingPolicyResources retrieves all AWSAutoScalingScalingPolicy items from an AWS CloudFormation template +func (t *Template) GetAllAWSAutoScalingScalingPolicyResources() map[string]AWSAutoScalingScalingPolicy { + results := map[string]AWSAutoScalingScalingPolicy{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAutoScalingScalingPolicy: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::ScalingPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingScalingPolicy + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAutoScalingScalingPolicyWithName retrieves all AWSAutoScalingScalingPolicy items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAutoScalingScalingPolicyWithName(name string) (AWSAutoScalingScalingPolicy, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAutoScalingScalingPolicy: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::ScalingPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingScalingPolicy + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAutoScalingScalingPolicy{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_stepadjustment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_stepadjustment.go new file mode 100644 index 0000000000..d85b91da08 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_stepadjustment.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSAutoScalingScalingPolicy_StepAdjustment AWS CloudFormation Resource (AWS::AutoScaling::ScalingPolicy.StepAdjustment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html +type AWSAutoScalingScalingPolicy_StepAdjustment struct { + + // MetricIntervalLowerBound AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-metricintervallowerbound + MetricIntervalLowerBound float64 `json:"MetricIntervalLowerBound,omitempty"` + + // MetricIntervalUpperBound AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-metricintervalupperbound + MetricIntervalUpperBound float64 `json:"MetricIntervalUpperBound,omitempty"` + + // ScalingAdjustment AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-scalingadjustment + ScalingAdjustment int `json:"ScalingAdjustment,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScalingPolicy_StepAdjustment) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScalingPolicy.StepAdjustment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingScalingPolicy_StepAdjustment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scheduledaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scheduledaction.go new file mode 100644 index 0000000000..b61e04fe0f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scheduledaction.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAutoScalingScheduledAction AWS CloudFormation Resource (AWS::AutoScaling::ScheduledAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-scheduledaction.html +type AWSAutoScalingScheduledAction struct { + + // AutoScalingGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-scheduledaction.html#cfn-as-scheduledaction-asgname + AutoScalingGroupName string `json:"AutoScalingGroupName,omitempty"` + + // DesiredCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-scheduledaction.html#cfn-as-scheduledaction-desiredcapacity + DesiredCapacity int `json:"DesiredCapacity,omitempty"` + + // EndTime AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-scheduledaction.html#cfn-as-scheduledaction-endtime + EndTime string `json:"EndTime,omitempty"` + + // MaxSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-scheduledaction.html#cfn-as-scheduledaction-maxsize + MaxSize int `json:"MaxSize,omitempty"` + + // MinSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-scheduledaction.html#cfn-as-scheduledaction-minsize + MinSize int `json:"MinSize,omitempty"` + + // Recurrence AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-scheduledaction.html#cfn-as-scheduledaction-recurrence + Recurrence string `json:"Recurrence,omitempty"` + + // StartTime AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-scheduledaction.html#cfn-as-scheduledaction-starttime + StartTime string `json:"StartTime,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScheduledAction) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScheduledAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSAutoScalingScheduledAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSAutoScalingScheduledAction) MarshalJSON() ([]byte, error) { + type Properties AWSAutoScalingScheduledAction + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAutoScalingScheduledAction) UnmarshalJSON(b []byte) error { + type Properties AWSAutoScalingScheduledAction + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSAutoScalingScheduledAction(*res.Properties) + } + + return nil +} + +// GetAllAWSAutoScalingScheduledActionResources retrieves all AWSAutoScalingScheduledAction items from an AWS CloudFormation template +func (t *Template) GetAllAWSAutoScalingScheduledActionResources() map[string]AWSAutoScalingScheduledAction { + results := map[string]AWSAutoScalingScheduledAction{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAutoScalingScheduledAction: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::ScheduledAction" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingScheduledAction + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAutoScalingScheduledActionWithName retrieves all AWSAutoScalingScheduledAction items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAutoScalingScheduledActionWithName(name string) (AWSAutoScalingScheduledAction, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAutoScalingScheduledAction: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::AutoScaling::ScheduledAction" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingScheduledAction + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAutoScalingScheduledAction{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-computeenvironment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-computeenvironment.go new file mode 100644 index 0000000000..96e3c2f596 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-computeenvironment.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSBatchComputeEnvironment AWS CloudFormation Resource (AWS::Batch::ComputeEnvironment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-computeenvironment.html +type AWSBatchComputeEnvironment struct { + + // ComputeEnvironmentName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-computeenvironment.html#cfn-batch-computeenvironment-computeenvironmentname + ComputeEnvironmentName string `json:"ComputeEnvironmentName,omitempty"` + + // ComputeResources AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-computeenvironment.html#cfn-batch-computeenvironment-computeresources + ComputeResources *AWSBatchComputeEnvironment_ComputeResources `json:"ComputeResources,omitempty"` + + // ServiceRole AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-computeenvironment.html#cfn-batch-computeenvironment-servicerole + ServiceRole string `json:"ServiceRole,omitempty"` + + // State AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-computeenvironment.html#cfn-batch-computeenvironment-state + State string `json:"State,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-computeenvironment.html#cfn-batch-computeenvironment-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchComputeEnvironment) AWSCloudFormationType() string { + return "AWS::Batch::ComputeEnvironment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchComputeEnvironment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSBatchComputeEnvironment) MarshalJSON() ([]byte, error) { + type Properties AWSBatchComputeEnvironment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSBatchComputeEnvironment) UnmarshalJSON(b []byte) error { + type Properties AWSBatchComputeEnvironment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSBatchComputeEnvironment(*res.Properties) + } + + return nil +} + +// GetAllAWSBatchComputeEnvironmentResources retrieves all AWSBatchComputeEnvironment items from an AWS CloudFormation template +func (t *Template) GetAllAWSBatchComputeEnvironmentResources() map[string]AWSBatchComputeEnvironment { + results := map[string]AWSBatchComputeEnvironment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSBatchComputeEnvironment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Batch::ComputeEnvironment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSBatchComputeEnvironment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSBatchComputeEnvironmentWithName retrieves all AWSBatchComputeEnvironment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSBatchComputeEnvironmentWithName(name string) (AWSBatchComputeEnvironment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSBatchComputeEnvironment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Batch::ComputeEnvironment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSBatchComputeEnvironment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSBatchComputeEnvironment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-computeenvironment_computeresources.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-computeenvironment_computeresources.go new file mode 100644 index 0000000000..1fc09413ef --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-computeenvironment_computeresources.go @@ -0,0 +1,81 @@ +package cloudformation + +// AWSBatchComputeEnvironment_ComputeResources AWS CloudFormation Resource (AWS::Batch::ComputeEnvironment.ComputeResources) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html +type AWSBatchComputeEnvironment_ComputeResources struct { + + // BidPercentage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-bidpercentage + BidPercentage int `json:"BidPercentage,omitempty"` + + // DesiredvCpus AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-desiredvcpus + DesiredvCpus int `json:"DesiredvCpus,omitempty"` + + // Ec2KeyPair AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-ec2keypair + Ec2KeyPair string `json:"Ec2KeyPair,omitempty"` + + // ImageId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-imageid + ImageId string `json:"ImageId,omitempty"` + + // InstanceRole AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-instancerole + InstanceRole string `json:"InstanceRole,omitempty"` + + // InstanceTypes AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-instancetypes + InstanceTypes []string `json:"InstanceTypes,omitempty"` + + // MaxvCpus AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-maxvcpus + MaxvCpus int `json:"MaxvCpus,omitempty"` + + // MinvCpus AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-minvcpus + MinvCpus int `json:"MinvCpus,omitempty"` + + // SecurityGroupIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SpotIamFleetRole AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-spotiamfleetrole + SpotIamFleetRole string `json:"SpotIamFleetRole,omitempty"` + + // Subnets AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-subnets + Subnets []string `json:"Subnets,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-tags + Tags interface{} `json:"Tags,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchComputeEnvironment_ComputeResources) AWSCloudFormationType() string { + return "AWS::Batch::ComputeEnvironment.ComputeResources" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchComputeEnvironment_ComputeResources) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition.go new file mode 100644 index 0000000000..992dbdf680 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSBatchJobDefinition AWS CloudFormation Resource (AWS::Batch::JobDefinition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html +type AWSBatchJobDefinition struct { + + // ContainerProperties AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html#cfn-batch-jobdefinition-containerproperties + ContainerProperties *AWSBatchJobDefinition_ContainerProperties `json:"ContainerProperties,omitempty"` + + // JobDefinitionName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html#cfn-batch-jobdefinition-jobdefinitionname + JobDefinitionName string `json:"JobDefinitionName,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html#cfn-batch-jobdefinition-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // RetryStrategy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html#cfn-batch-jobdefinition-retrystrategy + RetryStrategy *AWSBatchJobDefinition_RetryStrategy `json:"RetryStrategy,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html#cfn-batch-jobdefinition-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobDefinition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSBatchJobDefinition) MarshalJSON() ([]byte, error) { + type Properties AWSBatchJobDefinition + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSBatchJobDefinition) UnmarshalJSON(b []byte) error { + type Properties AWSBatchJobDefinition + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSBatchJobDefinition(*res.Properties) + } + + return nil +} + +// GetAllAWSBatchJobDefinitionResources retrieves all AWSBatchJobDefinition items from an AWS CloudFormation template +func (t *Template) GetAllAWSBatchJobDefinitionResources() map[string]AWSBatchJobDefinition { + results := map[string]AWSBatchJobDefinition{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSBatchJobDefinition: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Batch::JobDefinition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSBatchJobDefinition + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSBatchJobDefinitionWithName retrieves all AWSBatchJobDefinition items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSBatchJobDefinitionWithName(name string) (AWSBatchJobDefinition, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSBatchJobDefinition: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Batch::JobDefinition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSBatchJobDefinition + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSBatchJobDefinition{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_containerproperties.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_containerproperties.go new file mode 100644 index 0000000000..1feaf7577b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_containerproperties.go @@ -0,0 +1,76 @@ +package cloudformation + +// AWSBatchJobDefinition_ContainerProperties AWS CloudFormation Resource (AWS::Batch::JobDefinition.ContainerProperties) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html +type AWSBatchJobDefinition_ContainerProperties struct { + + // Command AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-command + Command []string `json:"Command,omitempty"` + + // Environment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-environment + Environment []AWSBatchJobDefinition_Environment `json:"Environment,omitempty"` + + // Image AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-image + Image string `json:"Image,omitempty"` + + // JobRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-jobrolearn + JobRoleArn string `json:"JobRoleArn,omitempty"` + + // Memory AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-memory + Memory int `json:"Memory,omitempty"` + + // MountPoints AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-mountpoints + MountPoints []AWSBatchJobDefinition_MountPoints `json:"MountPoints,omitempty"` + + // Privileged AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-privileged + Privileged bool `json:"Privileged,omitempty"` + + // ReadonlyRootFilesystem AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-readonlyrootfilesystem + ReadonlyRootFilesystem bool `json:"ReadonlyRootFilesystem,omitempty"` + + // Ulimits AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-ulimits + Ulimits []AWSBatchJobDefinition_Ulimit `json:"Ulimits,omitempty"` + + // User AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-user + User string `json:"User,omitempty"` + + // Vcpus AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-vcpus + Vcpus int `json:"Vcpus,omitempty"` + + // Volumes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-volumes + Volumes []AWSBatchJobDefinition_Volumes `json:"Volumes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_ContainerProperties) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.ContainerProperties" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobDefinition_ContainerProperties) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_environment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_environment.go new file mode 100644 index 0000000000..97a1082003 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_environment.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSBatchJobDefinition_Environment AWS CloudFormation Resource (AWS::Batch::JobDefinition.Environment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-environment.html +type AWSBatchJobDefinition_Environment struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-environment.html#cfn-batch-jobdefinition-environment-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-environment.html#cfn-batch-jobdefinition-environment-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_Environment) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.Environment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobDefinition_Environment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_mountpoints.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_mountpoints.go new file mode 100644 index 0000000000..c24b6a72f7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_mountpoints.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSBatchJobDefinition_MountPoints AWS CloudFormation Resource (AWS::Batch::JobDefinition.MountPoints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-mountpoints.html +type AWSBatchJobDefinition_MountPoints struct { + + // ContainerPath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-mountpoints.html#cfn-batch-jobdefinition-mountpoints-containerpath + ContainerPath string `json:"ContainerPath,omitempty"` + + // ReadOnly AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-mountpoints.html#cfn-batch-jobdefinition-mountpoints-readonly + ReadOnly bool `json:"ReadOnly,omitempty"` + + // SourceVolume AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-mountpoints.html#cfn-batch-jobdefinition-mountpoints-sourcevolume + SourceVolume string `json:"SourceVolume,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_MountPoints) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.MountPoints" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobDefinition_MountPoints) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_retrystrategy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_retrystrategy.go new file mode 100644 index 0000000000..3612e34b64 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_retrystrategy.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSBatchJobDefinition_RetryStrategy AWS CloudFormation Resource (AWS::Batch::JobDefinition.RetryStrategy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-retrystrategy.html +type AWSBatchJobDefinition_RetryStrategy struct { + + // Attempts AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-retrystrategy.html#cfn-batch-jobdefinition-retrystrategy-attempts + Attempts int `json:"Attempts,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_RetryStrategy) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.RetryStrategy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobDefinition_RetryStrategy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_ulimit.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_ulimit.go new file mode 100644 index 0000000000..15f4ae485e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_ulimit.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSBatchJobDefinition_Ulimit AWS CloudFormation Resource (AWS::Batch::JobDefinition.Ulimit) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-ulimit.html +type AWSBatchJobDefinition_Ulimit struct { + + // HardLimit AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-ulimit.html#cfn-batch-jobdefinition-ulimit-hardlimit + HardLimit int `json:"HardLimit,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-ulimit.html#cfn-batch-jobdefinition-ulimit-name + Name string `json:"Name,omitempty"` + + // SoftLimit AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-ulimit.html#cfn-batch-jobdefinition-ulimit-softlimit + SoftLimit int `json:"SoftLimit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_Ulimit) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.Ulimit" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobDefinition_Ulimit) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_volumes.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_volumes.go new file mode 100644 index 0000000000..1b19ab8780 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_volumes.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSBatchJobDefinition_Volumes AWS CloudFormation Resource (AWS::Batch::JobDefinition.Volumes) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-volumes.html +type AWSBatchJobDefinition_Volumes struct { + + // Host AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-volumes.html#cfn-batch-jobdefinition-volumes-host + Host *AWSBatchJobDefinition_VolumesHost `json:"Host,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-volumes.html#cfn-batch-jobdefinition-volumes-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_Volumes) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.Volumes" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobDefinition_Volumes) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_volumeshost.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_volumeshost.go new file mode 100644 index 0000000000..c403839dd6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_volumeshost.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSBatchJobDefinition_VolumesHost AWS CloudFormation Resource (AWS::Batch::JobDefinition.VolumesHost) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-volumeshost.html +type AWSBatchJobDefinition_VolumesHost struct { + + // SourcePath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-volumeshost.html#cfn-batch-jobdefinition-volumeshost-sourcepath + SourcePath string `json:"SourcePath,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_VolumesHost) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.VolumesHost" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobDefinition_VolumesHost) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobqueue.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobqueue.go new file mode 100644 index 0000000000..da44b34bbf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobqueue.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSBatchJobQueue AWS CloudFormation Resource (AWS::Batch::JobQueue) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobqueue.html +type AWSBatchJobQueue struct { + + // ComputeEnvironmentOrder AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobqueue.html#cfn-batch-jobqueue-computeenvironmentorder + ComputeEnvironmentOrder []AWSBatchJobQueue_ComputeEnvironmentOrder `json:"ComputeEnvironmentOrder,omitempty"` + + // JobQueueName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobqueue.html#cfn-batch-jobqueue-jobqueuename + JobQueueName string `json:"JobQueueName,omitempty"` + + // Priority AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobqueue.html#cfn-batch-jobqueue-priority + Priority int `json:"Priority,omitempty"` + + // State AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobqueue.html#cfn-batch-jobqueue-state + State string `json:"State,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobQueue) AWSCloudFormationType() string { + return "AWS::Batch::JobQueue" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobQueue) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSBatchJobQueue) MarshalJSON() ([]byte, error) { + type Properties AWSBatchJobQueue + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSBatchJobQueue) UnmarshalJSON(b []byte) error { + type Properties AWSBatchJobQueue + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSBatchJobQueue(*res.Properties) + } + + return nil +} + +// GetAllAWSBatchJobQueueResources retrieves all AWSBatchJobQueue items from an AWS CloudFormation template +func (t *Template) GetAllAWSBatchJobQueueResources() map[string]AWSBatchJobQueue { + results := map[string]AWSBatchJobQueue{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSBatchJobQueue: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Batch::JobQueue" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSBatchJobQueue + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSBatchJobQueueWithName retrieves all AWSBatchJobQueue items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSBatchJobQueueWithName(name string) (AWSBatchJobQueue, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSBatchJobQueue: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Batch::JobQueue" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSBatchJobQueue + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSBatchJobQueue{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobqueue_computeenvironmentorder.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobqueue_computeenvironmentorder.go new file mode 100644 index 0000000000..c03a32e025 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobqueue_computeenvironmentorder.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSBatchJobQueue_ComputeEnvironmentOrder AWS CloudFormation Resource (AWS::Batch::JobQueue.ComputeEnvironmentOrder) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobqueue-computeenvironmentorder.html +type AWSBatchJobQueue_ComputeEnvironmentOrder struct { + + // ComputeEnvironment AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobqueue-computeenvironmentorder.html#cfn-batch-jobqueue-computeenvironmentorder-computeenvironment + ComputeEnvironment string `json:"ComputeEnvironment,omitempty"` + + // Order AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobqueue-computeenvironmentorder.html#cfn-batch-jobqueue-computeenvironmentorder-order + Order int `json:"Order,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobQueue_ComputeEnvironmentOrder) AWSCloudFormationType() string { + return "AWS::Batch::JobQueue.ComputeEnvironmentOrder" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSBatchJobQueue_ComputeEnvironmentOrder) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-certificatemanager-certificate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-certificatemanager-certificate.go new file mode 100644 index 0000000000..1432156a41 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-certificatemanager-certificate.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCertificateManagerCertificate AWS CloudFormation Resource (AWS::CertificateManager::Certificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-certificatemanager-certificate.html +type AWSCertificateManagerCertificate struct { + + // DomainName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-certificatemanager-certificate.html#cfn-certificatemanager-certificate-domainname + DomainName string `json:"DomainName,omitempty"` + + // DomainValidationOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-certificatemanager-certificate.html#cfn-certificatemanager-certificate-domainvalidationoptions + DomainValidationOptions []AWSCertificateManagerCertificate_DomainValidationOption `json:"DomainValidationOptions,omitempty"` + + // SubjectAlternativeNames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-certificatemanager-certificate.html#cfn-certificatemanager-certificate-subjectalternativenames + SubjectAlternativeNames []string `json:"SubjectAlternativeNames,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-certificatemanager-certificate.html#cfn-certificatemanager-certificate-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCertificateManagerCertificate) AWSCloudFormationType() string { + return "AWS::CertificateManager::Certificate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCertificateManagerCertificate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCertificateManagerCertificate) MarshalJSON() ([]byte, error) { + type Properties AWSCertificateManagerCertificate + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCertificateManagerCertificate) UnmarshalJSON(b []byte) error { + type Properties AWSCertificateManagerCertificate + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCertificateManagerCertificate(*res.Properties) + } + + return nil +} + +// GetAllAWSCertificateManagerCertificateResources retrieves all AWSCertificateManagerCertificate items from an AWS CloudFormation template +func (t *Template) GetAllAWSCertificateManagerCertificateResources() map[string]AWSCertificateManagerCertificate { + results := map[string]AWSCertificateManagerCertificate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCertificateManagerCertificate: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CertificateManager::Certificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCertificateManagerCertificate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCertificateManagerCertificateWithName retrieves all AWSCertificateManagerCertificate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCertificateManagerCertificateWithName(name string) (AWSCertificateManagerCertificate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCertificateManagerCertificate: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CertificateManager::Certificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCertificateManagerCertificate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCertificateManagerCertificate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-certificatemanager-certificate_domainvalidationoption.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-certificatemanager-certificate_domainvalidationoption.go new file mode 100644 index 0000000000..49114e7811 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-certificatemanager-certificate_domainvalidationoption.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCertificateManagerCertificate_DomainValidationOption AWS CloudFormation Resource (AWS::CertificateManager::Certificate.DomainValidationOption) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-certificatemanager-certificate-domainvalidationoption.html +type AWSCertificateManagerCertificate_DomainValidationOption struct { + + // DomainName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-certificatemanager-certificate-domainvalidationoption.html#cfn-certificatemanager-certificate-domainvalidationoptions-domainname + DomainName string `json:"DomainName,omitempty"` + + // ValidationDomain AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-certificatemanager-certificate-domainvalidationoption.html#cfn-certificatemanager-certificate-domainvalidationoption-validationdomain + ValidationDomain string `json:"ValidationDomain,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCertificateManagerCertificate_DomainValidationOption) AWSCloudFormationType() string { + return "AWS::CertificateManager::Certificate.DomainValidationOption" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCertificateManagerCertificate_DomainValidationOption) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-customresource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-customresource.go new file mode 100644 index 0000000000..ed5ad4201e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-customresource.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudFormationCustomResource AWS CloudFormation Resource (AWS::CloudFormation::CustomResource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html +type AWSCloudFormationCustomResource struct { + + // ServiceToken AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html#cfn-customresource-servicetoken + ServiceToken string `json:"ServiceToken,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFormationCustomResource) AWSCloudFormationType() string { + return "AWS::CloudFormation::CustomResource" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFormationCustomResource) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCloudFormationCustomResource) MarshalJSON() ([]byte, error) { + type Properties AWSCloudFormationCustomResource + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudFormationCustomResource) UnmarshalJSON(b []byte) error { + type Properties AWSCloudFormationCustomResource + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCloudFormationCustomResource(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudFormationCustomResourceResources retrieves all AWSCloudFormationCustomResource items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudFormationCustomResourceResources() map[string]AWSCloudFormationCustomResource { + results := map[string]AWSCloudFormationCustomResource{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudFormationCustomResource: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFormation::CustomResource" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFormationCustomResource + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudFormationCustomResourceWithName retrieves all AWSCloudFormationCustomResource items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudFormationCustomResourceWithName(name string) (AWSCloudFormationCustomResource, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudFormationCustomResource: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFormation::CustomResource" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFormationCustomResource + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudFormationCustomResource{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-stack.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-stack.go new file mode 100644 index 0000000000..5213806f57 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-stack.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudFormationStack AWS CloudFormation Resource (AWS::CloudFormation::Stack) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html +type AWSCloudFormationStack struct { + + // NotificationARNs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-notificationarns + NotificationARNs []string `json:"NotificationARNs,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-parameters + Parameters map[string]string `json:"Parameters,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-tags + Tags []Tag `json:"Tags,omitempty"` + + // TemplateURL AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-templateurl + TemplateURL string `json:"TemplateURL,omitempty"` + + // TimeoutInMinutes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-timeoutinminutes + TimeoutInMinutes int `json:"TimeoutInMinutes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFormationStack) AWSCloudFormationType() string { + return "AWS::CloudFormation::Stack" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFormationStack) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCloudFormationStack) MarshalJSON() ([]byte, error) { + type Properties AWSCloudFormationStack + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudFormationStack) UnmarshalJSON(b []byte) error { + type Properties AWSCloudFormationStack + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCloudFormationStack(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudFormationStackResources retrieves all AWSCloudFormationStack items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudFormationStackResources() map[string]AWSCloudFormationStack { + results := map[string]AWSCloudFormationStack{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudFormationStack: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFormation::Stack" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFormationStack + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudFormationStackWithName retrieves all AWSCloudFormationStack items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudFormationStackWithName(name string) (AWSCloudFormationStack, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudFormationStack: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFormation::Stack" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFormationStack + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudFormationStack{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-waitcondition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-waitcondition.go new file mode 100644 index 0000000000..baedda4c00 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-waitcondition.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudFormationWaitCondition AWS CloudFormation Resource (AWS::CloudFormation::WaitCondition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waitcondition.html +type AWSCloudFormationWaitCondition struct { + + // Count AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waitcondition.html#cfn-waitcondition-count + Count int `json:"Count,omitempty"` + + // Handle AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waitcondition.html#cfn-waitcondition-handle + Handle string `json:"Handle,omitempty"` + + // Timeout AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waitcondition.html#cfn-waitcondition-timeout + Timeout string `json:"Timeout,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFormationWaitCondition) AWSCloudFormationType() string { + return "AWS::CloudFormation::WaitCondition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFormationWaitCondition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCloudFormationWaitCondition) MarshalJSON() ([]byte, error) { + type Properties AWSCloudFormationWaitCondition + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudFormationWaitCondition) UnmarshalJSON(b []byte) error { + type Properties AWSCloudFormationWaitCondition + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCloudFormationWaitCondition(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudFormationWaitConditionResources retrieves all AWSCloudFormationWaitCondition items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudFormationWaitConditionResources() map[string]AWSCloudFormationWaitCondition { + results := map[string]AWSCloudFormationWaitCondition{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudFormationWaitCondition: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFormation::WaitCondition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFormationWaitCondition + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudFormationWaitConditionWithName retrieves all AWSCloudFormationWaitCondition items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudFormationWaitConditionWithName(name string) (AWSCloudFormationWaitCondition, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudFormationWaitCondition: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFormation::WaitCondition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFormationWaitCondition + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudFormationWaitCondition{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-waitconditionhandle.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-waitconditionhandle.go new file mode 100644 index 0000000000..20da31dc5f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-waitconditionhandle.go @@ -0,0 +1,110 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudFormationWaitConditionHandle AWS CloudFormation Resource (AWS::CloudFormation::WaitConditionHandle) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waitconditionhandle.html +type AWSCloudFormationWaitConditionHandle struct { +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFormationWaitConditionHandle) AWSCloudFormationType() string { + return "AWS::CloudFormation::WaitConditionHandle" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFormationWaitConditionHandle) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCloudFormationWaitConditionHandle) MarshalJSON() ([]byte, error) { + type Properties AWSCloudFormationWaitConditionHandle + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudFormationWaitConditionHandle) UnmarshalJSON(b []byte) error { + type Properties AWSCloudFormationWaitConditionHandle + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCloudFormationWaitConditionHandle(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudFormationWaitConditionHandleResources retrieves all AWSCloudFormationWaitConditionHandle items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudFormationWaitConditionHandleResources() map[string]AWSCloudFormationWaitConditionHandle { + results := map[string]AWSCloudFormationWaitConditionHandle{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudFormationWaitConditionHandle: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFormation::WaitConditionHandle" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFormationWaitConditionHandle + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudFormationWaitConditionHandleWithName retrieves all AWSCloudFormationWaitConditionHandle items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudFormationWaitConditionHandleWithName(name string) (AWSCloudFormationWaitConditionHandle, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudFormationWaitConditionHandle: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFormation::WaitConditionHandle" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFormationWaitConditionHandle + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudFormationWaitConditionHandle{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution.go new file mode 100644 index 0000000000..b689111b2f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudFrontDistribution AWS CloudFormation Resource (AWS::CloudFront::Distribution) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution.html +type AWSCloudFrontDistribution struct { + + // DistributionConfig AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution.html#cfn-cloudfront-distribution-distributionconfig + DistributionConfig *AWSCloudFrontDistribution_DistributionConfig `json:"DistributionConfig,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCloudFrontDistribution) MarshalJSON() ([]byte, error) { + type Properties AWSCloudFrontDistribution + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudFrontDistribution) UnmarshalJSON(b []byte) error { + type Properties AWSCloudFrontDistribution + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCloudFrontDistribution(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudFrontDistributionResources retrieves all AWSCloudFrontDistribution items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudFrontDistributionResources() map[string]AWSCloudFrontDistribution { + results := map[string]AWSCloudFrontDistribution{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudFrontDistribution: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFront::Distribution" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFrontDistribution + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudFrontDistributionWithName retrieves all AWSCloudFrontDistribution items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudFrontDistributionWithName(name string) (AWSCloudFrontDistribution, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudFrontDistribution: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudFront::Distribution" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFrontDistribution + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudFrontDistribution{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_cachebehavior.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_cachebehavior.go new file mode 100644 index 0000000000..eb4d76db97 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_cachebehavior.go @@ -0,0 +1,76 @@ +package cloudformation + +// AWSCloudFrontDistribution_CacheBehavior AWS CloudFormation Resource (AWS::CloudFront::Distribution.CacheBehavior) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html +type AWSCloudFrontDistribution_CacheBehavior struct { + + // AllowedMethods AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-allowedmethods + AllowedMethods []string `json:"AllowedMethods,omitempty"` + + // CachedMethods AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-cachedmethods + CachedMethods []string `json:"CachedMethods,omitempty"` + + // Compress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-compress + Compress bool `json:"Compress,omitempty"` + + // DefaultTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-defaultttl + DefaultTTL int64 `json:"DefaultTTL,omitempty"` + + // ForwardedValues AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-forwardedvalues + ForwardedValues *AWSCloudFrontDistribution_ForwardedValues `json:"ForwardedValues,omitempty"` + + // MaxTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-maxttl + MaxTTL int64 `json:"MaxTTL,omitempty"` + + // MinTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-minttl + MinTTL int64 `json:"MinTTL,omitempty"` + + // PathPattern AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-pathpattern + PathPattern string `json:"PathPattern,omitempty"` + + // SmoothStreaming AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-smoothstreaming + SmoothStreaming bool `json:"SmoothStreaming,omitempty"` + + // TargetOriginId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-targetoriginid + TargetOriginId string `json:"TargetOriginId,omitempty"` + + // TrustedSigners AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-trustedsigners + TrustedSigners []string `json:"TrustedSigners,omitempty"` + + // ViewerProtocolPolicy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html#cfn-cloudfront-cachebehavior-viewerprotocolpolicy + ViewerProtocolPolicy string `json:"ViewerProtocolPolicy,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_CacheBehavior) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.CacheBehavior" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_CacheBehavior) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_cookies.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_cookies.go new file mode 100644 index 0000000000..ffee2e87db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_cookies.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCloudFrontDistribution_Cookies AWS CloudFormation Resource (AWS::CloudFront::Distribution.Cookies) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues-cookies.html +type AWSCloudFrontDistribution_Cookies struct { + + // Forward AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues-cookies.html#cfn-cloudfront-forwardedvalues-cookies-forward + Forward string `json:"Forward,omitempty"` + + // WhitelistedNames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues-cookies.html#cfn-cloudfront-forwardedvalues-cookies-whitelistednames + WhitelistedNames []string `json:"WhitelistedNames,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_Cookies) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.Cookies" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_Cookies) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_customerrorresponse.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_customerrorresponse.go new file mode 100644 index 0000000000..4ccaf1b3fe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_customerrorresponse.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSCloudFrontDistribution_CustomErrorResponse AWS CloudFormation Resource (AWS::CloudFront::Distribution.CustomErrorResponse) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-customerrorresponse.html +type AWSCloudFrontDistribution_CustomErrorResponse struct { + + // ErrorCachingMinTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-customerrorresponse.html#cfn-cloudfront-distributionconfig-customerrorresponse-errorcachingminttl + ErrorCachingMinTTL int64 `json:"ErrorCachingMinTTL,omitempty"` + + // ErrorCode AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-customerrorresponse.html#cfn-cloudfront-distributionconfig-customerrorresponse-errorcode + ErrorCode int `json:"ErrorCode,omitempty"` + + // ResponseCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-customerrorresponse.html#cfn-cloudfront-distributionconfig-customerrorresponse-responsecode + ResponseCode int `json:"ResponseCode,omitempty"` + + // ResponsePagePath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-customerrorresponse.html#cfn-cloudfront-distributionconfig-customerrorresponse-responsepagepath + ResponsePagePath string `json:"ResponsePagePath,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_CustomErrorResponse) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.CustomErrorResponse" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_CustomErrorResponse) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_customoriginconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_customoriginconfig.go new file mode 100644 index 0000000000..37071b411b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_customoriginconfig.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSCloudFrontDistribution_CustomOriginConfig AWS CloudFormation Resource (AWS::CloudFront::Distribution.CustomOriginConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-customorigin.html +type AWSCloudFrontDistribution_CustomOriginConfig struct { + + // HTTPPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-customorigin.html#cfn-cloudfront-customorigin-httpport + HTTPPort int `json:"HTTPPort,omitempty"` + + // HTTPSPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-customorigin.html#cfn-cloudfront-customorigin-httpsport + HTTPSPort int `json:"HTTPSPort,omitempty"` + + // OriginProtocolPolicy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-customorigin.html#cfn-cloudfront-customorigin-originprotocolpolicy + OriginProtocolPolicy string `json:"OriginProtocolPolicy,omitempty"` + + // OriginSSLProtocols AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-customorigin.html#cfn-cloudfront-customorigin-originsslprotocols + OriginSSLProtocols []string `json:"OriginSSLProtocols,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_CustomOriginConfig) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.CustomOriginConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_CustomOriginConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_defaultcachebehavior.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_defaultcachebehavior.go new file mode 100644 index 0000000000..9fee44cb53 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_defaultcachebehavior.go @@ -0,0 +1,71 @@ +package cloudformation + +// AWSCloudFrontDistribution_DefaultCacheBehavior AWS CloudFormation Resource (AWS::CloudFront::Distribution.DefaultCacheBehavior) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html +type AWSCloudFrontDistribution_DefaultCacheBehavior struct { + + // AllowedMethods AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-allowedmethods + AllowedMethods []string `json:"AllowedMethods,omitempty"` + + // CachedMethods AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-cachedmethods + CachedMethods []string `json:"CachedMethods,omitempty"` + + // Compress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-compress + Compress bool `json:"Compress,omitempty"` + + // DefaultTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-defaultttl + DefaultTTL int64 `json:"DefaultTTL,omitempty"` + + // ForwardedValues AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-forwardedvalues + ForwardedValues *AWSCloudFrontDistribution_ForwardedValues `json:"ForwardedValues,omitempty"` + + // MaxTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-maxttl + MaxTTL int64 `json:"MaxTTL,omitempty"` + + // MinTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-minttl + MinTTL int64 `json:"MinTTL,omitempty"` + + // SmoothStreaming AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-smoothstreaming + SmoothStreaming bool `json:"SmoothStreaming,omitempty"` + + // TargetOriginId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-targetoriginid + TargetOriginId string `json:"TargetOriginId,omitempty"` + + // TrustedSigners AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-trustedsigners + TrustedSigners []string `json:"TrustedSigners,omitempty"` + + // ViewerProtocolPolicy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html#cfn-cloudfront-defaultcachebehavior-viewerprotocolpolicy + ViewerProtocolPolicy string `json:"ViewerProtocolPolicy,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_DefaultCacheBehavior) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.DefaultCacheBehavior" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_DefaultCacheBehavior) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_distributionconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_distributionconfig.go new file mode 100644 index 0000000000..0d410d433f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_distributionconfig.go @@ -0,0 +1,86 @@ +package cloudformation + +// AWSCloudFrontDistribution_DistributionConfig AWS CloudFormation Resource (AWS::CloudFront::Distribution.DistributionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html +type AWSCloudFrontDistribution_DistributionConfig struct { + + // Aliases AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-aliases + Aliases []string `json:"Aliases,omitempty"` + + // CacheBehaviors AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-cachebehaviors + CacheBehaviors []AWSCloudFrontDistribution_CacheBehavior `json:"CacheBehaviors,omitempty"` + + // Comment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-comment + Comment string `json:"Comment,omitempty"` + + // CustomErrorResponses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-customerrorresponses + CustomErrorResponses []AWSCloudFrontDistribution_CustomErrorResponse `json:"CustomErrorResponses,omitempty"` + + // DefaultCacheBehavior AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-defaultcachebehavior + DefaultCacheBehavior *AWSCloudFrontDistribution_DefaultCacheBehavior `json:"DefaultCacheBehavior,omitempty"` + + // DefaultRootObject AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-defaultrootobject + DefaultRootObject string `json:"DefaultRootObject,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-enabled + Enabled bool `json:"Enabled,omitempty"` + + // HttpVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-httpversion + HttpVersion string `json:"HttpVersion,omitempty"` + + // Logging AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-logging + Logging *AWSCloudFrontDistribution_Logging `json:"Logging,omitempty"` + + // Origins AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-origins + Origins []AWSCloudFrontDistribution_Origin `json:"Origins,omitempty"` + + // PriceClass AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-priceclass + PriceClass string `json:"PriceClass,omitempty"` + + // Restrictions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-restrictions + Restrictions *AWSCloudFrontDistribution_Restrictions `json:"Restrictions,omitempty"` + + // ViewerCertificate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-viewercertificate + ViewerCertificate *AWSCloudFrontDistribution_ViewerCertificate `json:"ViewerCertificate,omitempty"` + + // WebACLId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html#cfn-cloudfront-distributionconfig-webaclid + WebACLId string `json:"WebACLId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_DistributionConfig) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.DistributionConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_DistributionConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_forwardedvalues.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_forwardedvalues.go new file mode 100644 index 0000000000..29c592858c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_forwardedvalues.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSCloudFrontDistribution_ForwardedValues AWS CloudFormation Resource (AWS::CloudFront::Distribution.ForwardedValues) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues.html +type AWSCloudFrontDistribution_ForwardedValues struct { + + // Cookies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues.html#cfn-cloudfront-forwardedvalues-cookies + Cookies *AWSCloudFrontDistribution_Cookies `json:"Cookies,omitempty"` + + // Headers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues.html#cfn-cloudfront-forwardedvalues-headers + Headers []string `json:"Headers,omitempty"` + + // QueryString AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues.html#cfn-cloudfront-forwardedvalues-querystring + QueryString bool `json:"QueryString,omitempty"` + + // QueryStringCacheKeys AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues.html#cfn-cloudfront-forwardedvalues-querystringcachekeys + QueryStringCacheKeys []string `json:"QueryStringCacheKeys,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_ForwardedValues) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.ForwardedValues" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_ForwardedValues) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_georestriction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_georestriction.go new file mode 100644 index 0000000000..41a81c0bcc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_georestriction.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCloudFrontDistribution_GeoRestriction AWS CloudFormation Resource (AWS::CloudFront::Distribution.GeoRestriction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions-georestriction.html +type AWSCloudFrontDistribution_GeoRestriction struct { + + // Locations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions-georestriction.html#cfn-cloudfront-distributionconfig-restrictions-georestriction-locations + Locations []string `json:"Locations,omitempty"` + + // RestrictionType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions-georestriction.html#cfn-cloudfront-distributionconfig-restrictions-georestriction-restrictiontype + RestrictionType string `json:"RestrictionType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_GeoRestriction) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.GeoRestriction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_GeoRestriction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_logging.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_logging.go new file mode 100644 index 0000000000..f11af1b5f2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_logging.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCloudFrontDistribution_Logging AWS CloudFormation Resource (AWS::CloudFront::Distribution.Logging) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-logging.html +type AWSCloudFrontDistribution_Logging struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-logging.html#cfn-cloudfront-logging-bucket + Bucket string `json:"Bucket,omitempty"` + + // IncludeCookies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-logging.html#cfn-cloudfront-logging-includecookies + IncludeCookies bool `json:"IncludeCookies,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-logging.html#cfn-cloudfront-logging-prefix + Prefix string `json:"Prefix,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_Logging) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.Logging" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_Logging) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_origin.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_origin.go new file mode 100644 index 0000000000..364956d28b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_origin.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSCloudFrontDistribution_Origin AWS CloudFormation Resource (AWS::CloudFront::Distribution.Origin) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html +type AWSCloudFrontDistribution_Origin struct { + + // CustomOriginConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html#cfn-cloudfront-origin-customorigin + CustomOriginConfig *AWSCloudFrontDistribution_CustomOriginConfig `json:"CustomOriginConfig,omitempty"` + + // DomainName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html#cfn-cloudfront-origin-domainname + DomainName string `json:"DomainName,omitempty"` + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html#cfn-cloudfront-origin-id + Id string `json:"Id,omitempty"` + + // OriginCustomHeaders AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html#cfn-cloudfront-origin-origincustomheaders + OriginCustomHeaders []AWSCloudFrontDistribution_OriginCustomHeader `json:"OriginCustomHeaders,omitempty"` + + // OriginPath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html#cfn-cloudfront-origin-originpath + OriginPath string `json:"OriginPath,omitempty"` + + // S3OriginConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html#cfn-cloudfront-origin-s3origin + S3OriginConfig *AWSCloudFrontDistribution_S3OriginConfig `json:"S3OriginConfig,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_Origin) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.Origin" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_Origin) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_origincustomheader.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_origincustomheader.go new file mode 100644 index 0000000000..653c9d62d7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_origincustomheader.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCloudFrontDistribution_OriginCustomHeader AWS CloudFormation Resource (AWS::CloudFront::Distribution.OriginCustomHeader) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin-origincustomheader.html +type AWSCloudFrontDistribution_OriginCustomHeader struct { + + // HeaderName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin-origincustomheader.html#cfn-cloudfront-origin-origincustomheader-headername + HeaderName string `json:"HeaderName,omitempty"` + + // HeaderValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin-origincustomheader.html#cfn-cloudfront-origin-origincustomheader-headervalue + HeaderValue string `json:"HeaderValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_OriginCustomHeader) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.OriginCustomHeader" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_OriginCustomHeader) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_restrictions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_restrictions.go new file mode 100644 index 0000000000..208d3b0d99 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_restrictions.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSCloudFrontDistribution_Restrictions AWS CloudFormation Resource (AWS::CloudFront::Distribution.Restrictions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions.html +type AWSCloudFrontDistribution_Restrictions struct { + + // GeoRestriction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions.html#cfn-cloudfront-distributionconfig-restrictions-georestriction + GeoRestriction *AWSCloudFrontDistribution_GeoRestriction `json:"GeoRestriction,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_Restrictions) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.Restrictions" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_Restrictions) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_s3originconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_s3originconfig.go new file mode 100644 index 0000000000..4547dc4a38 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_s3originconfig.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSCloudFrontDistribution_S3OriginConfig AWS CloudFormation Resource (AWS::CloudFront::Distribution.S3OriginConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-s3origin.html +type AWSCloudFrontDistribution_S3OriginConfig struct { + + // OriginAccessIdentity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-s3origin.html#cfn-cloudfront-s3origin-originaccessidentity + OriginAccessIdentity string `json:"OriginAccessIdentity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_S3OriginConfig) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.S3OriginConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_S3OriginConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_viewercertificate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_viewercertificate.go new file mode 100644 index 0000000000..1e5da6506b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_viewercertificate.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSCloudFrontDistribution_ViewerCertificate AWS CloudFormation Resource (AWS::CloudFront::Distribution.ViewerCertificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-viewercertificate.html +type AWSCloudFrontDistribution_ViewerCertificate struct { + + // AcmCertificateArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-viewercertificate.html#cfn-cloudfront-distributionconfig-viewercertificate-acmcertificatearn + AcmCertificateArn string `json:"AcmCertificateArn,omitempty"` + + // CloudFrontDefaultCertificate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-viewercertificate.html#cfn-cloudfront-distributionconfig-viewercertificate-cloudfrontdefaultcertificate + CloudFrontDefaultCertificate bool `json:"CloudFrontDefaultCertificate,omitempty"` + + // IamCertificateId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-viewercertificate.html#cfn-cloudfront-distributionconfig-viewercertificate-iamcertificateid + IamCertificateId string `json:"IamCertificateId,omitempty"` + + // MinimumProtocolVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-viewercertificate.html#cfn-cloudfront-distributionconfig-viewercertificate-sslsupportmethod + MinimumProtocolVersion string `json:"MinimumProtocolVersion,omitempty"` + + // SslSupportMethod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-viewercertificate.html#cfn-cloudfront-distributionconfig-viewercertificate-minimumprotocolversion + SslSupportMethod string `json:"SslSupportMethod,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_ViewerCertificate) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.ViewerCertificate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudFrontDistribution_ViewerCertificate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail.go new file mode 100644 index 0000000000..197af45c35 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail.go @@ -0,0 +1,170 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudTrailTrail AWS CloudFormation Resource (AWS::CloudTrail::Trail) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html +type AWSCloudTrailTrail struct { + + // CloudWatchLogsLogGroupArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-cloudwatchlogsloggroupaem + CloudWatchLogsLogGroupArn string `json:"CloudWatchLogsLogGroupArn,omitempty"` + + // CloudWatchLogsRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-cloudwatchlogsrolearn + CloudWatchLogsRoleArn string `json:"CloudWatchLogsRoleArn,omitempty"` + + // EnableLogFileValidation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-enablelogfilevalidation + EnableLogFileValidation bool `json:"EnableLogFileValidation,omitempty"` + + // IncludeGlobalServiceEvents AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-includeglobalserviceevents + IncludeGlobalServiceEvents bool `json:"IncludeGlobalServiceEvents,omitempty"` + + // IsLogging AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-islogging + IsLogging bool `json:"IsLogging,omitempty"` + + // IsMultiRegionTrail AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-ismultiregiontrail + IsMultiRegionTrail bool `json:"IsMultiRegionTrail,omitempty"` + + // KMSKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-kmskeyid + KMSKeyId string `json:"KMSKeyId,omitempty"` + + // S3BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-s3bucketname + S3BucketName string `json:"S3BucketName,omitempty"` + + // S3KeyPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-s3keyprefix + S3KeyPrefix string `json:"S3KeyPrefix,omitempty"` + + // SnsTopicName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-snstopicname + SnsTopicName string `json:"SnsTopicName,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#cfn-cloudtrail-trail-tags + Tags []Tag `json:"Tags,omitempty"` + + // TrailName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail.html#aws-cloudtrail-trail-trailname + TrailName string `json:"TrailName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudTrailTrail) AWSCloudFormationType() string { + return "AWS::CloudTrail::Trail" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudTrailTrail) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCloudTrailTrail) MarshalJSON() ([]byte, error) { + type Properties AWSCloudTrailTrail + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudTrailTrail) UnmarshalJSON(b []byte) error { + type Properties AWSCloudTrailTrail + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCloudTrailTrail(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudTrailTrailResources retrieves all AWSCloudTrailTrail items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudTrailTrailResources() map[string]AWSCloudTrailTrail { + results := map[string]AWSCloudTrailTrail{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudTrailTrail: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudTrail::Trail" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudTrailTrail + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudTrailTrailWithName retrieves all AWSCloudTrailTrail items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudTrailTrailWithName(name string) (AWSCloudTrailTrail, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudTrailTrail: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudTrail::Trail" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudTrailTrail + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudTrailTrail{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-alarm.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-alarm.go new file mode 100644 index 0000000000..cb0f68314d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-alarm.go @@ -0,0 +1,200 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudWatchAlarm AWS CloudFormation Resource (AWS::CloudWatch::Alarm) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html +type AWSCloudWatchAlarm struct { + + // ActionsEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-actionsenabled + ActionsEnabled bool `json:"ActionsEnabled,omitempty"` + + // AlarmActions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-alarmactions + AlarmActions []string `json:"AlarmActions,omitempty"` + + // AlarmDescription AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-alarmdescription + AlarmDescription string `json:"AlarmDescription,omitempty"` + + // AlarmName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-alarmname + AlarmName string `json:"AlarmName,omitempty"` + + // ComparisonOperator AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-comparisonoperator + ComparisonOperator string `json:"ComparisonOperator,omitempty"` + + // Dimensions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-dimension + Dimensions []AWSCloudWatchAlarm_Dimension `json:"Dimensions,omitempty"` + + // EvaluateLowSampleCountPercentile AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-evaluatelowsamplecountpercentile + EvaluateLowSampleCountPercentile string `json:"EvaluateLowSampleCountPercentile,omitempty"` + + // EvaluationPeriods AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-evaluationperiods + EvaluationPeriods int `json:"EvaluationPeriods,omitempty"` + + // ExtendedStatistic AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-extendedstatistic + ExtendedStatistic string `json:"ExtendedStatistic,omitempty"` + + // InsufficientDataActions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-insufficientdataactions + InsufficientDataActions []string `json:"InsufficientDataActions,omitempty"` + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-metricname + MetricName string `json:"MetricName,omitempty"` + + // Namespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-namespace + Namespace string `json:"Namespace,omitempty"` + + // OKActions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-okactions + OKActions []string `json:"OKActions,omitempty"` + + // Period AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-period + Period int `json:"Period,omitempty"` + + // Statistic AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-statistic + Statistic string `json:"Statistic,omitempty"` + + // Threshold AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-threshold + Threshold float64 `json:"Threshold,omitempty"` + + // TreatMissingData AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-treatmissingdata + TreatMissingData string `json:"TreatMissingData,omitempty"` + + // Unit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html#cfn-cloudwatch-alarms-unit + Unit string `json:"Unit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudWatchAlarm) AWSCloudFormationType() string { + return "AWS::CloudWatch::Alarm" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudWatchAlarm) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCloudWatchAlarm) MarshalJSON() ([]byte, error) { + type Properties AWSCloudWatchAlarm + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudWatchAlarm) UnmarshalJSON(b []byte) error { + type Properties AWSCloudWatchAlarm + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCloudWatchAlarm(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudWatchAlarmResources retrieves all AWSCloudWatchAlarm items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudWatchAlarmResources() map[string]AWSCloudWatchAlarm { + results := map[string]AWSCloudWatchAlarm{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudWatchAlarm: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudWatch::Alarm" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudWatchAlarm + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudWatchAlarmWithName retrieves all AWSCloudWatchAlarm items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudWatchAlarmWithName(name string) (AWSCloudWatchAlarm, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudWatchAlarm: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudWatch::Alarm" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudWatchAlarm + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudWatchAlarm{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-alarm_dimension.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-alarm_dimension.go new file mode 100644 index 0000000000..1759ef56e0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-alarm_dimension.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCloudWatchAlarm_Dimension AWS CloudFormation Resource (AWS::CloudWatch::Alarm.Dimension) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-dimension.html +type AWSCloudWatchAlarm_Dimension struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-dimension.html#cfn-cloudwatch-alarm-dimension-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-dimension.html#cfn-cloudwatch-alarm-dimension-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudWatchAlarm_Dimension) AWSCloudFormationType() string { + return "AWS::CloudWatch::Alarm.Dimension" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudWatchAlarm_Dimension) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-dashboard.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-dashboard.go new file mode 100644 index 0000000000..666d3d7ac4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-dashboard.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudWatchDashboard AWS CloudFormation Resource (AWS::CloudWatch::Dashboard) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-dashboard.html +type AWSCloudWatchDashboard struct { + + // DashboardBody AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-dashboard.html#cfn-cloudwatch-dashboard-dashboardbody + DashboardBody string `json:"DashboardBody,omitempty"` + + // DashboardName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-dashboard.html#cfn-cloudwatch-dashboard-dashboardname + DashboardName string `json:"DashboardName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudWatchDashboard) AWSCloudFormationType() string { + return "AWS::CloudWatch::Dashboard" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCloudWatchDashboard) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCloudWatchDashboard) MarshalJSON() ([]byte, error) { + type Properties AWSCloudWatchDashboard + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudWatchDashboard) UnmarshalJSON(b []byte) error { + type Properties AWSCloudWatchDashboard + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCloudWatchDashboard(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudWatchDashboardResources retrieves all AWSCloudWatchDashboard items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudWatchDashboardResources() map[string]AWSCloudWatchDashboard { + results := map[string]AWSCloudWatchDashboard{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudWatchDashboard: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudWatch::Dashboard" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudWatchDashboard + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudWatchDashboardWithName retrieves all AWSCloudWatchDashboard items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudWatchDashboardWithName(name string) (AWSCloudWatchDashboard, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudWatchDashboard: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CloudWatch::Dashboard" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudWatchDashboard + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudWatchDashboard{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project.go new file mode 100644 index 0000000000..382be1cc53 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCodeBuildProject AWS CloudFormation Resource (AWS::CodeBuild::Project) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html +type AWSCodeBuildProject struct { + + // Artifacts AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-artifacts + Artifacts *AWSCodeBuildProject_Artifacts `json:"Artifacts,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-description + Description string `json:"Description,omitempty"` + + // EncryptionKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-encryptionkey + EncryptionKey string `json:"EncryptionKey,omitempty"` + + // Environment AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-environment + Environment *AWSCodeBuildProject_Environment `json:"Environment,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-name + Name string `json:"Name,omitempty"` + + // ServiceRole AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-servicerole + ServiceRole string `json:"ServiceRole,omitempty"` + + // Source AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-source + Source *AWSCodeBuildProject_Source `json:"Source,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-tags + Tags []Tag `json:"Tags,omitempty"` + + // TimeoutInMinutes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-timeoutinminutes + TimeoutInMinutes int `json:"TimeoutInMinutes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeBuildProject) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCodeBuildProject) MarshalJSON() ([]byte, error) { + type Properties AWSCodeBuildProject + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCodeBuildProject) UnmarshalJSON(b []byte) error { + type Properties AWSCodeBuildProject + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCodeBuildProject(*res.Properties) + } + + return nil +} + +// GetAllAWSCodeBuildProjectResources retrieves all AWSCodeBuildProject items from an AWS CloudFormation template +func (t *Template) GetAllAWSCodeBuildProjectResources() map[string]AWSCodeBuildProject { + results := map[string]AWSCodeBuildProject{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCodeBuildProject: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeBuild::Project" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeBuildProject + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCodeBuildProjectWithName retrieves all AWSCodeBuildProject items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCodeBuildProjectWithName(name string) (AWSCodeBuildProject, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCodeBuildProject: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeBuild::Project" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeBuildProject + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCodeBuildProject{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_artifacts.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_artifacts.go new file mode 100644 index 0000000000..433b378cb4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_artifacts.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSCodeBuildProject_Artifacts AWS CloudFormation Resource (AWS::CodeBuild::Project.Artifacts) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html +type AWSCodeBuildProject_Artifacts struct { + + // Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html#cfn-codebuild-project-artifacts-location + Location string `json:"Location,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html#cfn-codebuild-project-artifacts-name + Name string `json:"Name,omitempty"` + + // NamespaceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html#cfn-codebuild-project-artifacts-namespacetype + NamespaceType string `json:"NamespaceType,omitempty"` + + // Packaging AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html#cfn-codebuild-project-artifacts-packaging + Packaging string `json:"Packaging,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html#cfn-codebuild-project-artifacts-path + Path string `json:"Path,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html#cfn-codebuild-project-artifacts-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_Artifacts) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.Artifacts" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeBuildProject_Artifacts) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_environment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_environment.go new file mode 100644 index 0000000000..827fd00b3a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_environment.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSCodeBuildProject_Environment AWS CloudFormation Resource (AWS::CodeBuild::Project.Environment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environment.html +type AWSCodeBuildProject_Environment struct { + + // ComputeType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environment.html#cfn-codebuild-project-environment-computetype + ComputeType string `json:"ComputeType,omitempty"` + + // EnvironmentVariables AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environment.html#cfn-codebuild-project-environment-environmentvariables + EnvironmentVariables []AWSCodeBuildProject_EnvironmentVariable `json:"EnvironmentVariables,omitempty"` + + // Image AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environment.html#cfn-codebuild-project-environment-image + Image string `json:"Image,omitempty"` + + // PrivilegedMode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environment.html#cfn-codebuild-project-environment-privilegedmode + PrivilegedMode bool `json:"PrivilegedMode,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environment.html#cfn-codebuild-project-environment-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_Environment) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.Environment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeBuildProject_Environment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_environmentvariable.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_environmentvariable.go new file mode 100644 index 0000000000..becd721991 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_environmentvariable.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCodeBuildProject_EnvironmentVariable AWS CloudFormation Resource (AWS::CodeBuild::Project.EnvironmentVariable) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environmentvariable.html +type AWSCodeBuildProject_EnvironmentVariable struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environmentvariable.html#cfn-codebuild-project-environmentvariable-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environmentvariable.html#cfn-codebuild-project-environmentvariable-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_EnvironmentVariable) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.EnvironmentVariable" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeBuildProject_EnvironmentVariable) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_source.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_source.go new file mode 100644 index 0000000000..83cd1790c1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_source.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSCodeBuildProject_Source AWS CloudFormation Resource (AWS::CodeBuild::Project.Source) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html +type AWSCodeBuildProject_Source struct { + + // Auth AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-auth + Auth *AWSCodeBuildProject_SourceAuth `json:"Auth,omitempty"` + + // BuildSpec AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-buildspec + BuildSpec string `json:"BuildSpec,omitempty"` + + // Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-location + Location string `json:"Location,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_Source) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.Source" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeBuildProject_Source) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_sourceauth.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_sourceauth.go new file mode 100644 index 0000000000..3e9cc6f93a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_sourceauth.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCodeBuildProject_SourceAuth AWS CloudFormation Resource (AWS::CodeBuild::Project.SourceAuth) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-sourceauth.html +type AWSCodeBuildProject_SourceAuth struct { + + // Resource AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-sourceauth.html#cfn-codebuild-project-sourceauth-resource + Resource string `json:"Resource,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-sourceauth.html#cfn-codebuild-project-sourceauth-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_SourceAuth) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.SourceAuth" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeBuildProject_SourceAuth) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codecommit-repository.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codecommit-repository.go new file mode 100644 index 0000000000..2ab3a1453b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codecommit-repository.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCodeCommitRepository AWS CloudFormation Resource (AWS::CodeCommit::Repository) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html +type AWSCodeCommitRepository struct { + + // RepositoryDescription AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html#cfn-codecommit-repository-repositorydescription + RepositoryDescription string `json:"RepositoryDescription,omitempty"` + + // RepositoryName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html#cfn-codecommit-repository-repositoryname + RepositoryName string `json:"RepositoryName,omitempty"` + + // Triggers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codecommit-repository.html#cfn-codecommit-repository-triggers + Triggers []AWSCodeCommitRepository_RepositoryTrigger `json:"Triggers,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeCommitRepository) AWSCloudFormationType() string { + return "AWS::CodeCommit::Repository" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeCommitRepository) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCodeCommitRepository) MarshalJSON() ([]byte, error) { + type Properties AWSCodeCommitRepository + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCodeCommitRepository) UnmarshalJSON(b []byte) error { + type Properties AWSCodeCommitRepository + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCodeCommitRepository(*res.Properties) + } + + return nil +} + +// GetAllAWSCodeCommitRepositoryResources retrieves all AWSCodeCommitRepository items from an AWS CloudFormation template +func (t *Template) GetAllAWSCodeCommitRepositoryResources() map[string]AWSCodeCommitRepository { + results := map[string]AWSCodeCommitRepository{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCodeCommitRepository: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeCommit::Repository" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeCommitRepository + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCodeCommitRepositoryWithName retrieves all AWSCodeCommitRepository items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCodeCommitRepositoryWithName(name string) (AWSCodeCommitRepository, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCodeCommitRepository: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeCommit::Repository" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeCommitRepository + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCodeCommitRepository{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codecommit-repository_repositorytrigger.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codecommit-repository_repositorytrigger.go new file mode 100644 index 0000000000..bc8cefe838 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codecommit-repository_repositorytrigger.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSCodeCommitRepository_RepositoryTrigger AWS CloudFormation Resource (AWS::CodeCommit::Repository.RepositoryTrigger) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html +type AWSCodeCommitRepository_RepositoryTrigger struct { + + // Branches AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-branches + Branches []string `json:"Branches,omitempty"` + + // CustomData AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-customdata + CustomData string `json:"CustomData,omitempty"` + + // DestinationArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-destinationarn + DestinationArn string `json:"DestinationArn,omitempty"` + + // Events AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-events + Events []string `json:"Events,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codecommit-repository-repositorytrigger.html#cfn-codecommit-repository-repositorytrigger-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeCommitRepository_RepositoryTrigger) AWSCloudFormationType() string { + return "AWS::CodeCommit::Repository.RepositoryTrigger" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeCommitRepository_RepositoryTrigger) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-application.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-application.go new file mode 100644 index 0000000000..c5523d3425 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-application.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCodeDeployApplication AWS CloudFormation Resource (AWS::CodeDeploy::Application) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-application.html +type AWSCodeDeployApplication struct { + + // ApplicationName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-application.html#cfn-codedeploy-application-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployApplication) AWSCloudFormationType() string { + return "AWS::CodeDeploy::Application" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployApplication) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCodeDeployApplication) MarshalJSON() ([]byte, error) { + type Properties AWSCodeDeployApplication + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCodeDeployApplication) UnmarshalJSON(b []byte) error { + type Properties AWSCodeDeployApplication + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCodeDeployApplication(*res.Properties) + } + + return nil +} + +// GetAllAWSCodeDeployApplicationResources retrieves all AWSCodeDeployApplication items from an AWS CloudFormation template +func (t *Template) GetAllAWSCodeDeployApplicationResources() map[string]AWSCodeDeployApplication { + results := map[string]AWSCodeDeployApplication{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCodeDeployApplication: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeDeploy::Application" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeDeployApplication + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCodeDeployApplicationWithName retrieves all AWSCodeDeployApplication items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCodeDeployApplicationWithName(name string) (AWSCodeDeployApplication, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCodeDeployApplication: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeDeploy::Application" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeDeployApplication + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCodeDeployApplication{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentconfig.go new file mode 100644 index 0000000000..e6deb77007 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentconfig.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCodeDeployDeploymentConfig AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentconfig.html +type AWSCodeDeployDeploymentConfig struct { + + // DeploymentConfigName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentconfig.html#cfn-codedeploy-deploymentconfig-deploymentconfigname + DeploymentConfigName string `json:"DeploymentConfigName,omitempty"` + + // MinimumHealthyHosts AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentconfig.html#cfn-codedeploy-deploymentconfig-minimumhealthyhosts + MinimumHealthyHosts *AWSCodeDeployDeploymentConfig_MinimumHealthyHosts `json:"MinimumHealthyHosts,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentConfig) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCodeDeployDeploymentConfig) MarshalJSON() ([]byte, error) { + type Properties AWSCodeDeployDeploymentConfig + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCodeDeployDeploymentConfig) UnmarshalJSON(b []byte) error { + type Properties AWSCodeDeployDeploymentConfig + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCodeDeployDeploymentConfig(*res.Properties) + } + + return nil +} + +// GetAllAWSCodeDeployDeploymentConfigResources retrieves all AWSCodeDeployDeploymentConfig items from an AWS CloudFormation template +func (t *Template) GetAllAWSCodeDeployDeploymentConfigResources() map[string]AWSCodeDeployDeploymentConfig { + results := map[string]AWSCodeDeployDeploymentConfig{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCodeDeployDeploymentConfig: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeDeploy::DeploymentConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeDeployDeploymentConfig + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCodeDeployDeploymentConfigWithName retrieves all AWSCodeDeployDeploymentConfig items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCodeDeployDeploymentConfigWithName(name string) (AWSCodeDeployDeploymentConfig, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCodeDeployDeploymentConfig: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeDeploy::DeploymentConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeDeployDeploymentConfig + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCodeDeployDeploymentConfig{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentconfig_minimumhealthyhosts.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentconfig_minimumhealthyhosts.go new file mode 100644 index 0000000000..b3e3a0b9cc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentconfig_minimumhealthyhosts.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCodeDeployDeploymentConfig_MinimumHealthyHosts AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentConfig.MinimumHealthyHosts) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentconfig-minimumhealthyhosts.html +type AWSCodeDeployDeploymentConfig_MinimumHealthyHosts struct { + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentconfig-minimumhealthyhosts.html#cfn-codedeploy-deploymentconfig-minimumhealthyhosts-type + Type string `json:"Type,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentconfig-minimumhealthyhosts.html#cfn-codedeploy-deploymentconfig-minimumhealthyhosts-value + Value int `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentConfig_MinimumHealthyHosts) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentConfig.MinimumHealthyHosts" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentConfig_MinimumHealthyHosts) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup.go new file mode 100644 index 0000000000..42691bb45b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup.go @@ -0,0 +1,160 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCodeDeployDeploymentGroup AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html +type AWSCodeDeployDeploymentGroup struct { + + // AlarmConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-alarmconfiguration + AlarmConfiguration *AWSCodeDeployDeploymentGroup_AlarmConfiguration `json:"AlarmConfiguration,omitempty"` + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` + + // AutoScalingGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-autoscalinggroups + AutoScalingGroups []string `json:"AutoScalingGroups,omitempty"` + + // Deployment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-deployment + Deployment *AWSCodeDeployDeploymentGroup_Deployment `json:"Deployment,omitempty"` + + // DeploymentConfigName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-deploymentconfigname + DeploymentConfigName string `json:"DeploymentConfigName,omitempty"` + + // DeploymentGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-deploymentgroupname + DeploymentGroupName string `json:"DeploymentGroupName,omitempty"` + + // Ec2TagFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-ec2tagfilters + Ec2TagFilters []AWSCodeDeployDeploymentGroup_EC2TagFilter `json:"Ec2TagFilters,omitempty"` + + // OnPremisesInstanceTagFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-onpremisesinstancetagfilters + OnPremisesInstanceTagFilters []AWSCodeDeployDeploymentGroup_TagFilter `json:"OnPremisesInstanceTagFilters,omitempty"` + + // ServiceRoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-servicerolearn + ServiceRoleArn string `json:"ServiceRoleArn,omitempty"` + + // TriggerConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-triggerconfigurations + TriggerConfigurations []AWSCodeDeployDeploymentGroup_TriggerConfig `json:"TriggerConfigurations,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCodeDeployDeploymentGroup) MarshalJSON() ([]byte, error) { + type Properties AWSCodeDeployDeploymentGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCodeDeployDeploymentGroup) UnmarshalJSON(b []byte) error { + type Properties AWSCodeDeployDeploymentGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCodeDeployDeploymentGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSCodeDeployDeploymentGroupResources retrieves all AWSCodeDeployDeploymentGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSCodeDeployDeploymentGroupResources() map[string]AWSCodeDeployDeploymentGroup { + results := map[string]AWSCodeDeployDeploymentGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCodeDeployDeploymentGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeDeploy::DeploymentGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeDeployDeploymentGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCodeDeployDeploymentGroupWithName retrieves all AWSCodeDeployDeploymentGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCodeDeployDeploymentGroupWithName(name string) (AWSCodeDeployDeploymentGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCodeDeployDeploymentGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodeDeploy::DeploymentGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodeDeployDeploymentGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCodeDeployDeploymentGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_alarm.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_alarm.go new file mode 100644 index 0000000000..e7486f1f79 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_alarm.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_Alarm AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.Alarm) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-alarm.html +type AWSCodeDeployDeploymentGroup_Alarm struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-alarm.html#cfn-codedeploy-deploymentgroup-alarm-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_Alarm) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.Alarm" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_Alarm) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_alarmconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_alarmconfiguration.go new file mode 100644 index 0000000000..0836c8aed7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_alarmconfiguration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_AlarmConfiguration AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.AlarmConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-alarmconfiguration.html +type AWSCodeDeployDeploymentGroup_AlarmConfiguration struct { + + // Alarms AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-alarmconfiguration.html#cfn-codedeploy-deploymentgroup-alarmconfiguration-alarms + Alarms []AWSCodeDeployDeploymentGroup_Alarm `json:"Alarms,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-alarmconfiguration.html#cfn-codedeploy-deploymentgroup-alarmconfiguration-enabled + Enabled bool `json:"Enabled,omitempty"` + + // IgnorePollAlarmFailure AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-alarmconfiguration.html#cfn-codedeploy-deploymentgroup-alarmconfiguration-ignorepollalarmfailure + IgnorePollAlarmFailure bool `json:"IgnorePollAlarmFailure,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_AlarmConfiguration) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.AlarmConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_AlarmConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_deployment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_deployment.go new file mode 100644 index 0000000000..7904d96919 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_deployment.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_Deployment AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.Deployment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment.html +type AWSCodeDeployDeploymentGroup_Deployment struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment.html#cfn-properties-codedeploy-deploymentgroup-deployment-description + Description string `json:"Description,omitempty"` + + // IgnoreApplicationStopFailures AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment.html#cfn-properties-codedeploy-deploymentgroup-deployment-ignoreapplicationstopfailures + IgnoreApplicationStopFailures bool `json:"IgnoreApplicationStopFailures,omitempty"` + + // Revision AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision + Revision *AWSCodeDeployDeploymentGroup_RevisionLocation `json:"Revision,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_Deployment) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.Deployment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_Deployment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_ec2tagfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_ec2tagfilter.go new file mode 100644 index 0000000000..7f70503027 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_ec2tagfilter.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_EC2TagFilter AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.EC2TagFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-ec2tagfilters.html +type AWSCodeDeployDeploymentGroup_EC2TagFilter struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-ec2tagfilters.html#cfn-properties-codedeploy-deploymentgroup-ec2tagfilters-key + Key string `json:"Key,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-ec2tagfilters.html#cfn-properties-codedeploy-deploymentgroup-ec2tagfilters-type + Type string `json:"Type,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-ec2tagfilters.html#cfn-properties-codedeploy-deploymentgroup-ec2tagfilters-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_EC2TagFilter) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.EC2TagFilter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_EC2TagFilter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_githublocation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_githublocation.go new file mode 100644 index 0000000000..ae994c5397 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_githublocation.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_GitHubLocation AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.GitHubLocation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-githublocation.html +type AWSCodeDeployDeploymentGroup_GitHubLocation struct { + + // CommitId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-githublocation.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-githublocation-commitid + CommitId string `json:"CommitId,omitempty"` + + // Repository AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-githublocation.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-githublocation-repository + Repository string `json:"Repository,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_GitHubLocation) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.GitHubLocation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_GitHubLocation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_revisionlocation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_revisionlocation.go new file mode 100644 index 0000000000..57242d26de --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_revisionlocation.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_RevisionLocation AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.RevisionLocation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision.html +type AWSCodeDeployDeploymentGroup_RevisionLocation struct { + + // GitHubLocation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-githublocation + GitHubLocation *AWSCodeDeployDeploymentGroup_GitHubLocation `json:"GitHubLocation,omitempty"` + + // RevisionType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-revisiontype + RevisionType string `json:"RevisionType,omitempty"` + + // S3Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-s3location + S3Location *AWSCodeDeployDeploymentGroup_S3Location `json:"S3Location,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_RevisionLocation) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.RevisionLocation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_RevisionLocation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_s3location.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_s3location.go new file mode 100644 index 0000000000..f606041c78 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_s3location.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_S3Location AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.S3Location) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-s3location.html +type AWSCodeDeployDeploymentGroup_S3Location struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-s3location.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-s3location-bucket + Bucket string `json:"Bucket,omitempty"` + + // BundleType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-s3location.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-s3location-bundletype + BundleType string `json:"BundleType,omitempty"` + + // ETag AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-s3location.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-s3location-etag + ETag string `json:"ETag,omitempty"` + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-s3location.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-s3location-key + Key string `json:"Key,omitempty"` + + // Version AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deployment-revision-s3location.html#cfn-properties-codedeploy-deploymentgroup-deployment-revision-s3location-value + Version string `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_S3Location) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.S3Location" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_S3Location) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_tagfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_tagfilter.go new file mode 100644 index 0000000000..095fe75f25 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_tagfilter.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_TagFilter AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.TagFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-onpremisesinstancetagfilters.html +type AWSCodeDeployDeploymentGroup_TagFilter struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-onpremisesinstancetagfilters.html#cfn-properties-codedeploy-deploymentgroup-onpremisesinstancetagfilters-key + Key string `json:"Key,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-onpremisesinstancetagfilters.html#cfn-properties-codedeploy-deploymentgroup-onpremisesinstancetagfilters-type + Type string `json:"Type,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-onpremisesinstancetagfilters.html#cfn-properties-codedeploy-deploymentgroup-onpremisesinstancetagfilters-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_TagFilter) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.TagFilter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_TagFilter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_triggerconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_triggerconfig.go new file mode 100644 index 0000000000..7a5ed3b862 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_triggerconfig.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_TriggerConfig AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.TriggerConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-triggerconfig.html +type AWSCodeDeployDeploymentGroup_TriggerConfig struct { + + // TriggerEvents AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-triggerconfig.html#cfn-codedeploy-deploymentgroup-triggerconfig-triggerevents + TriggerEvents []string `json:"TriggerEvents,omitempty"` + + // TriggerName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-triggerconfig.html#cfn-codedeploy-deploymentgroup-triggerconfig-triggername + TriggerName string `json:"TriggerName,omitempty"` + + // TriggerTargetArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-triggerconfig.html#cfn-codedeploy-deploymentgroup-triggerconfig-triggertargetarn + TriggerTargetArn string `json:"TriggerTargetArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_TriggerConfig) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.TriggerConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodeDeployDeploymentGroup_TriggerConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype.go new file mode 100644 index 0000000000..9714df3544 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCodePipelineCustomActionType AWS CloudFormation Resource (AWS::CodePipeline::CustomActionType) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html +type AWSCodePipelineCustomActionType struct { + + // Category AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html#cfn-codepipeline-customactiontype-category + Category string `json:"Category,omitempty"` + + // ConfigurationProperties AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html#cfn-codepipeline-customactiontype-configurationproperties + ConfigurationProperties []AWSCodePipelineCustomActionType_ConfigurationProperties `json:"ConfigurationProperties,omitempty"` + + // InputArtifactDetails AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html#cfn-codepipeline-customactiontype-inputartifactdetails + InputArtifactDetails *AWSCodePipelineCustomActionType_ArtifactDetails `json:"InputArtifactDetails,omitempty"` + + // OutputArtifactDetails AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html#cfn-codepipeline-customactiontype-outputartifactdetails + OutputArtifactDetails *AWSCodePipelineCustomActionType_ArtifactDetails `json:"OutputArtifactDetails,omitempty"` + + // Provider AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html#cfn-codepipeline-customactiontype-provider + Provider string `json:"Provider,omitempty"` + + // Settings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html#cfn-codepipeline-customactiontype-settings + Settings *AWSCodePipelineCustomActionType_Settings `json:"Settings,omitempty"` + + // Version AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype.html#cfn-codepipeline-customactiontype-version + Version string `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineCustomActionType) AWSCloudFormationType() string { + return "AWS::CodePipeline::CustomActionType" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelineCustomActionType) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCodePipelineCustomActionType) MarshalJSON() ([]byte, error) { + type Properties AWSCodePipelineCustomActionType + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCodePipelineCustomActionType) UnmarshalJSON(b []byte) error { + type Properties AWSCodePipelineCustomActionType + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCodePipelineCustomActionType(*res.Properties) + } + + return nil +} + +// GetAllAWSCodePipelineCustomActionTypeResources retrieves all AWSCodePipelineCustomActionType items from an AWS CloudFormation template +func (t *Template) GetAllAWSCodePipelineCustomActionTypeResources() map[string]AWSCodePipelineCustomActionType { + results := map[string]AWSCodePipelineCustomActionType{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCodePipelineCustomActionType: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodePipeline::CustomActionType" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodePipelineCustomActionType + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCodePipelineCustomActionTypeWithName retrieves all AWSCodePipelineCustomActionType items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCodePipelineCustomActionTypeWithName(name string) (AWSCodePipelineCustomActionType, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCodePipelineCustomActionType: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodePipeline::CustomActionType" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodePipelineCustomActionType + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCodePipelineCustomActionType{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_artifactdetails.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_artifactdetails.go new file mode 100644 index 0000000000..b276c7c1d4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_artifactdetails.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCodePipelineCustomActionType_ArtifactDetails AWS CloudFormation Resource (AWS::CodePipeline::CustomActionType.ArtifactDetails) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-artifactdetails.html +type AWSCodePipelineCustomActionType_ArtifactDetails struct { + + // MaximumCount AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-artifactdetails.html#cfn-codepipeline-customactiontype-artifactdetails-maximumcount + MaximumCount int `json:"MaximumCount,omitempty"` + + // MinimumCount AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-artifactdetails.html#cfn-codepipeline-customactiontype-artifactdetails-minimumcount + MinimumCount int `json:"MinimumCount,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineCustomActionType_ArtifactDetails) AWSCloudFormationType() string { + return "AWS::CodePipeline::CustomActionType.ArtifactDetails" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelineCustomActionType_ArtifactDetails) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_configurationproperties.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_configurationproperties.go new file mode 100644 index 0000000000..2ce1465eff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_configurationproperties.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSCodePipelineCustomActionType_ConfigurationProperties AWS CloudFormation Resource (AWS::CodePipeline::CustomActionType.ConfigurationProperties) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-configurationproperties.html +type AWSCodePipelineCustomActionType_ConfigurationProperties struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-description + Description string `json:"Description,omitempty"` + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-key + Key bool `json:"Key,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-name + Name string `json:"Name,omitempty"` + + // Queryable AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-queryable + Queryable bool `json:"Queryable,omitempty"` + + // Required AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-required + Required bool `json:"Required,omitempty"` + + // Secret AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-secret + Secret bool `json:"Secret,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineCustomActionType_ConfigurationProperties) AWSCloudFormationType() string { + return "AWS::CodePipeline::CustomActionType.ConfigurationProperties" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelineCustomActionType_ConfigurationProperties) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_settings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_settings.go new file mode 100644 index 0000000000..85307f5055 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_settings.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSCodePipelineCustomActionType_Settings AWS CloudFormation Resource (AWS::CodePipeline::CustomActionType.Settings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-settings.html +type AWSCodePipelineCustomActionType_Settings struct { + + // EntityUrlTemplate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-settings.html#cfn-codepipeline-customactiontype-settings-entityurltemplate + EntityUrlTemplate string `json:"EntityUrlTemplate,omitempty"` + + // ExecutionUrlTemplate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-settings.html#cfn-codepipeline-customactiontype-settings-executionurltemplate + ExecutionUrlTemplate string `json:"ExecutionUrlTemplate,omitempty"` + + // RevisionUrlTemplate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-settings.html#cfn-codepipeline-customactiontype-settings-revisionurltemplate + RevisionUrlTemplate string `json:"RevisionUrlTemplate,omitempty"` + + // ThirdPartyConfigurationUrl AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-customactiontype-settings.html#cfn-codepipeline-customactiontype-settings-thirdpartyconfigurationurl + ThirdPartyConfigurationUrl string `json:"ThirdPartyConfigurationUrl,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineCustomActionType_Settings) AWSCloudFormationType() string { + return "AWS::CodePipeline::CustomActionType.Settings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelineCustomActionType_Settings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline.go new file mode 100644 index 0000000000..ddc3f85f6d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCodePipelinePipeline AWS CloudFormation Resource (AWS::CodePipeline::Pipeline) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html +type AWSCodePipelinePipeline struct { + + // ArtifactStore AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#cfn-codepipeline-pipeline-artifactstore + ArtifactStore *AWSCodePipelinePipeline_ArtifactStore `json:"ArtifactStore,omitempty"` + + // DisableInboundStageTransitions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#cfn-codepipeline-pipeline-disableinboundstagetransitions + DisableInboundStageTransitions []AWSCodePipelinePipeline_StageTransition `json:"DisableInboundStageTransitions,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#cfn-codepipeline-pipeline-name + Name string `json:"Name,omitempty"` + + // RestartExecutionOnUpdate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#cfn-codepipeline-pipeline-restartexecutiononupdate + RestartExecutionOnUpdate bool `json:"RestartExecutionOnUpdate,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#cfn-codepipeline-pipeline-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // Stages AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#cfn-codepipeline-pipeline-stages + Stages []AWSCodePipelinePipeline_StageDeclaration `json:"Stages,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCodePipelinePipeline) MarshalJSON() ([]byte, error) { + type Properties AWSCodePipelinePipeline + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCodePipelinePipeline) UnmarshalJSON(b []byte) error { + type Properties AWSCodePipelinePipeline + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCodePipelinePipeline(*res.Properties) + } + + return nil +} + +// GetAllAWSCodePipelinePipelineResources retrieves all AWSCodePipelinePipeline items from an AWS CloudFormation template +func (t *Template) GetAllAWSCodePipelinePipelineResources() map[string]AWSCodePipelinePipeline { + results := map[string]AWSCodePipelinePipeline{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCodePipelinePipeline: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodePipeline::Pipeline" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodePipelinePipeline + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCodePipelinePipelineWithName retrieves all AWSCodePipelinePipeline items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCodePipelinePipelineWithName(name string) (AWSCodePipelinePipeline, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCodePipelinePipeline: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::CodePipeline::Pipeline" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodePipelinePipeline + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCodePipelinePipeline{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_actiondeclaration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_actiondeclaration.go new file mode 100644 index 0000000000..67a7a687ec --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_actiondeclaration.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSCodePipelinePipeline_ActionDeclaration AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.ActionDeclaration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html +type AWSCodePipelinePipeline_ActionDeclaration struct { + + // ActionTypeId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html#cfn-codepipeline-pipeline-stages-actions-actiontypeid + ActionTypeId *AWSCodePipelinePipeline_ActionTypeId `json:"ActionTypeId,omitempty"` + + // Configuration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html#cfn-codepipeline-pipeline-stages-actions-configuration + Configuration interface{} `json:"Configuration,omitempty"` + + // InputArtifacts AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html#cfn-codepipeline-pipeline-stages-actions-inputartifacts + InputArtifacts []AWSCodePipelinePipeline_InputArtifact `json:"InputArtifacts,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html#cfn-codepipeline-pipeline-stages-actions-name + Name string `json:"Name,omitempty"` + + // OutputArtifacts AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html#cfn-codepipeline-pipeline-stages-actions-outputartifacts + OutputArtifacts []AWSCodePipelinePipeline_OutputArtifact `json:"OutputArtifacts,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html#cfn-codepipeline-pipeline-stages-actions-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // RunOrder AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html#cfn-codepipeline-pipeline-stages-actions-runorder + RunOrder int `json:"RunOrder,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_ActionDeclaration) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.ActionDeclaration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_ActionDeclaration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_actiontypeid.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_actiontypeid.go new file mode 100644 index 0000000000..367130cb8f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_actiontypeid.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSCodePipelinePipeline_ActionTypeId AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.ActionTypeId) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-actiontypeid.html +type AWSCodePipelinePipeline_ActionTypeId struct { + + // Category AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-actiontypeid.html#cfn-codepipeline-pipeline-stages-actions-actiontypeid-category + Category string `json:"Category,omitempty"` + + // Owner AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-actiontypeid.html#cfn-codepipeline-pipeline-stages-actions-actiontypeid-owner + Owner string `json:"Owner,omitempty"` + + // Provider AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-actiontypeid.html#cfn-codepipeline-pipeline-stages-actions-actiontypeid-provider + Provider string `json:"Provider,omitempty"` + + // Version AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-actiontypeid.html#cfn-codepipeline-pipeline-stages-actions-actiontypeid-version + Version string `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_ActionTypeId) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.ActionTypeId" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_ActionTypeId) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_artifactstore.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_artifactstore.go new file mode 100644 index 0000000000..e6857817c9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_artifactstore.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCodePipelinePipeline_ArtifactStore AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.ArtifactStore) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-artifactstore.html +type AWSCodePipelinePipeline_ArtifactStore struct { + + // EncryptionKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-artifactstore.html#cfn-codepipeline-pipeline-artifactstore-encryptionkey + EncryptionKey *AWSCodePipelinePipeline_EncryptionKey `json:"EncryptionKey,omitempty"` + + // Location AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-artifactstore.html#cfn-codepipeline-pipeline-artifactstore-location + Location string `json:"Location,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-artifactstore.html#cfn-codepipeline-pipeline-artifactstore-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_ArtifactStore) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.ArtifactStore" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_ArtifactStore) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_blockerdeclaration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_blockerdeclaration.go new file mode 100644 index 0000000000..b5492605a1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_blockerdeclaration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCodePipelinePipeline_BlockerDeclaration AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.BlockerDeclaration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-blockers.html +type AWSCodePipelinePipeline_BlockerDeclaration struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-blockers.html#cfn-codepipeline-pipeline-stages-blockers-name + Name string `json:"Name,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-blockers.html#cfn-codepipeline-pipeline-stages-blockers-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_BlockerDeclaration) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.BlockerDeclaration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_BlockerDeclaration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_encryptionkey.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_encryptionkey.go new file mode 100644 index 0000000000..d8ca157313 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_encryptionkey.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCodePipelinePipeline_EncryptionKey AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.EncryptionKey) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-artifactstore-encryptionkey.html +type AWSCodePipelinePipeline_EncryptionKey struct { + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-artifactstore-encryptionkey.html#cfn-codepipeline-pipeline-artifactstore-encryptionkey-id + Id string `json:"Id,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-artifactstore-encryptionkey.html#cfn-codepipeline-pipeline-artifactstore-encryptionkey-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_EncryptionKey) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.EncryptionKey" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_EncryptionKey) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_inputartifact.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_inputartifact.go new file mode 100644 index 0000000000..db29f57b73 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_inputartifact.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSCodePipelinePipeline_InputArtifact AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.InputArtifact) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-inputartifacts.html +type AWSCodePipelinePipeline_InputArtifact struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-inputartifacts.html#cfn-codepipeline-pipeline-stages-actions-inputartifacts-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_InputArtifact) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.InputArtifact" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_InputArtifact) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_outputartifact.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_outputartifact.go new file mode 100644 index 0000000000..a7f4bb69b7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_outputartifact.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSCodePipelinePipeline_OutputArtifact AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.OutputArtifact) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-outputartifacts.html +type AWSCodePipelinePipeline_OutputArtifact struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions-outputartifacts.html#cfn-codepipeline-pipeline-stages-actions-outputartifacts-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_OutputArtifact) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.OutputArtifact" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_OutputArtifact) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_stagedeclaration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_stagedeclaration.go new file mode 100644 index 0000000000..dee733439b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_stagedeclaration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCodePipelinePipeline_StageDeclaration AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.StageDeclaration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages.html +type AWSCodePipelinePipeline_StageDeclaration struct { + + // Actions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages.html#cfn-codepipeline-pipeline-stages-actions + Actions []AWSCodePipelinePipeline_ActionDeclaration `json:"Actions,omitempty"` + + // Blockers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages.html#cfn-codepipeline-pipeline-stages-blockers + Blockers []AWSCodePipelinePipeline_BlockerDeclaration `json:"Blockers,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages.html#cfn-codepipeline-pipeline-stages-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_StageDeclaration) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.StageDeclaration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_StageDeclaration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_stagetransition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_stagetransition.go new file mode 100644 index 0000000000..81304329b3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_stagetransition.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCodePipelinePipeline_StageTransition AWS CloudFormation Resource (AWS::CodePipeline::Pipeline.StageTransition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-disableinboundstagetransitions.html +type AWSCodePipelinePipeline_StageTransition struct { + + // Reason AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-disableinboundstagetransitions.html#cfn-codepipeline-pipeline-disableinboundstagetransitions-reason + Reason string `json:"Reason,omitempty"` + + // StageName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-disableinboundstagetransitions.html#cfn-codepipeline-pipeline-disableinboundstagetransitions-stagename + StageName string `json:"StageName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_StageTransition) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.StageTransition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCodePipelinePipeline_StageTransition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool.go new file mode 100644 index 0000000000..519459f997 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool.go @@ -0,0 +1,160 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCognitoIdentityPool AWS CloudFormation Resource (AWS::Cognito::IdentityPool) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html +type AWSCognitoIdentityPool struct { + + // AllowUnauthenticatedIdentities AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-allowunauthenticatedidentities + AllowUnauthenticatedIdentities bool `json:"AllowUnauthenticatedIdentities,omitempty"` + + // CognitoEvents AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-cognitoevents + CognitoEvents interface{} `json:"CognitoEvents,omitempty"` + + // CognitoIdentityProviders AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-cognitoidentityproviders + CognitoIdentityProviders []AWSCognitoIdentityPool_CognitoIdentityProvider `json:"CognitoIdentityProviders,omitempty"` + + // CognitoStreams AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-cognitostreams + CognitoStreams *AWSCognitoIdentityPool_CognitoStreams `json:"CognitoStreams,omitempty"` + + // DeveloperProviderName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-developerprovidername + DeveloperProviderName string `json:"DeveloperProviderName,omitempty"` + + // IdentityPoolName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-identitypoolname + IdentityPoolName string `json:"IdentityPoolName,omitempty"` + + // OpenIdConnectProviderARNs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-openidconnectproviderarns + OpenIdConnectProviderARNs []string `json:"OpenIdConnectProviderARNs,omitempty"` + + // PushSync AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-pushsync + PushSync *AWSCognitoIdentityPool_PushSync `json:"PushSync,omitempty"` + + // SamlProviderARNs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-samlproviderarns + SamlProviderARNs []string `json:"SamlProviderARNs,omitempty"` + + // SupportedLoginProviders AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-supportedloginproviders + SupportedLoginProviders interface{} `json:"SupportedLoginProviders,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPool) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPool" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoIdentityPool) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCognitoIdentityPool) MarshalJSON() ([]byte, error) { + type Properties AWSCognitoIdentityPool + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCognitoIdentityPool) UnmarshalJSON(b []byte) error { + type Properties AWSCognitoIdentityPool + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCognitoIdentityPool(*res.Properties) + } + + return nil +} + +// GetAllAWSCognitoIdentityPoolResources retrieves all AWSCognitoIdentityPool items from an AWS CloudFormation template +func (t *Template) GetAllAWSCognitoIdentityPoolResources() map[string]AWSCognitoIdentityPool { + results := map[string]AWSCognitoIdentityPool{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCognitoIdentityPool: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::IdentityPool" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoIdentityPool + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCognitoIdentityPoolWithName retrieves all AWSCognitoIdentityPool items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCognitoIdentityPoolWithName(name string) (AWSCognitoIdentityPool, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCognitoIdentityPool: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::IdentityPool" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoIdentityPool + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCognitoIdentityPool{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_cognitoidentityprovider.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_cognitoidentityprovider.go new file mode 100644 index 0000000000..a238b50f42 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_cognitoidentityprovider.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCognitoIdentityPool_CognitoIdentityProvider AWS CloudFormation Resource (AWS::Cognito::IdentityPool.CognitoIdentityProvider) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitoidentityprovider.html +type AWSCognitoIdentityPool_CognitoIdentityProvider struct { + + // ClientId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitoidentityprovider.html#cfn-cognito-identitypool-cognitoidentityprovider-clientid + ClientId string `json:"ClientId,omitempty"` + + // ProviderName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitoidentityprovider.html#cfn-cognito-identitypool-cognitoidentityprovider-providername + ProviderName string `json:"ProviderName,omitempty"` + + // ServerSideTokenCheck AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitoidentityprovider.html#cfn-cognito-identitypool-cognitoidentityprovider-serversidetokencheck + ServerSideTokenCheck bool `json:"ServerSideTokenCheck,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPool_CognitoIdentityProvider) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPool.CognitoIdentityProvider" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoIdentityPool_CognitoIdentityProvider) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_cognitostreams.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_cognitostreams.go new file mode 100644 index 0000000000..0e0a27139b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_cognitostreams.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCognitoIdentityPool_CognitoStreams AWS CloudFormation Resource (AWS::Cognito::IdentityPool.CognitoStreams) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitostreams.html +type AWSCognitoIdentityPool_CognitoStreams struct { + + // RoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitostreams.html#cfn-cognito-identitypool-cognitostreams-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // StreamName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitostreams.html#cfn-cognito-identitypool-cognitostreams-streamname + StreamName string `json:"StreamName,omitempty"` + + // StreamingStatus AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitostreams.html#cfn-cognito-identitypool-cognitostreams-streamingstatus + StreamingStatus string `json:"StreamingStatus,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPool_CognitoStreams) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPool.CognitoStreams" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoIdentityPool_CognitoStreams) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_pushsync.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_pushsync.go new file mode 100644 index 0000000000..9a8ce25d3d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_pushsync.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCognitoIdentityPool_PushSync AWS CloudFormation Resource (AWS::Cognito::IdentityPool.PushSync) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-pushsync.html +type AWSCognitoIdentityPool_PushSync struct { + + // ApplicationArns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-pushsync.html#cfn-cognito-identitypool-pushsync-applicationarns + ApplicationArns []string `json:"ApplicationArns,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-pushsync.html#cfn-cognito-identitypool-pushsync-rolearn + RoleArn string `json:"RoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPool_PushSync) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPool.PushSync" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoIdentityPool_PushSync) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment.go new file mode 100644 index 0000000000..97f2a374ef --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCognitoIdentityPoolRoleAttachment AWS CloudFormation Resource (AWS::Cognito::IdentityPoolRoleAttachment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html +type AWSCognitoIdentityPoolRoleAttachment struct { + + // IdentityPoolId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html#cfn-cognito-identitypoolroleattachment-identitypoolid + IdentityPoolId string `json:"IdentityPoolId,omitempty"` + + // RoleMappings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html#cfn-cognito-identitypoolroleattachment-rolemappings + RoleMappings interface{} `json:"RoleMappings,omitempty"` + + // Roles AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html#cfn-cognito-identitypoolroleattachment-roles + Roles interface{} `json:"Roles,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPoolRoleAttachment) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPoolRoleAttachment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoIdentityPoolRoleAttachment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCognitoIdentityPoolRoleAttachment) MarshalJSON() ([]byte, error) { + type Properties AWSCognitoIdentityPoolRoleAttachment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCognitoIdentityPoolRoleAttachment) UnmarshalJSON(b []byte) error { + type Properties AWSCognitoIdentityPoolRoleAttachment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCognitoIdentityPoolRoleAttachment(*res.Properties) + } + + return nil +} + +// GetAllAWSCognitoIdentityPoolRoleAttachmentResources retrieves all AWSCognitoIdentityPoolRoleAttachment items from an AWS CloudFormation template +func (t *Template) GetAllAWSCognitoIdentityPoolRoleAttachmentResources() map[string]AWSCognitoIdentityPoolRoleAttachment { + results := map[string]AWSCognitoIdentityPoolRoleAttachment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCognitoIdentityPoolRoleAttachment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::IdentityPoolRoleAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoIdentityPoolRoleAttachment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCognitoIdentityPoolRoleAttachmentWithName retrieves all AWSCognitoIdentityPoolRoleAttachment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCognitoIdentityPoolRoleAttachmentWithName(name string) (AWSCognitoIdentityPoolRoleAttachment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCognitoIdentityPoolRoleAttachment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::IdentityPoolRoleAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoIdentityPoolRoleAttachment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCognitoIdentityPoolRoleAttachment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_mappingrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_mappingrule.go new file mode 100644 index 0000000000..76fc85dcc2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_mappingrule.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSCognitoIdentityPoolRoleAttachment_MappingRule AWS CloudFormation Resource (AWS::Cognito::IdentityPoolRoleAttachment.MappingRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-mappingrule.html +type AWSCognitoIdentityPoolRoleAttachment_MappingRule struct { + + // Claim AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-mappingrule.html#cfn-cognito-identitypoolroleattachment-mappingrule-claim + Claim string `json:"Claim,omitempty"` + + // MatchType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-mappingrule.html#cfn-cognito-identitypoolroleattachment-mappingrule-matchtype + MatchType string `json:"MatchType,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-mappingrule.html#cfn-cognito-identitypoolroleattachment-mappingrule-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-mappingrule.html#cfn-cognito-identitypoolroleattachment-mappingrule-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPoolRoleAttachment_MappingRule) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPoolRoleAttachment.MappingRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoIdentityPoolRoleAttachment_MappingRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_rolemapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_rolemapping.go new file mode 100644 index 0000000000..b97d467df0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_rolemapping.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCognitoIdentityPoolRoleAttachment_RoleMapping AWS CloudFormation Resource (AWS::Cognito::IdentityPoolRoleAttachment.RoleMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rolemapping.html +type AWSCognitoIdentityPoolRoleAttachment_RoleMapping struct { + + // AmbiguousRoleResolution AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rolemapping.html#cfn-cognito-identitypoolroleattachment-rolemapping-ambiguousroleresolution + AmbiguousRoleResolution string `json:"AmbiguousRoleResolution,omitempty"` + + // RulesConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rolemapping.html#cfn-cognito-identitypoolroleattachment-rolemapping-rulesconfiguration + RulesConfiguration *AWSCognitoIdentityPoolRoleAttachment_RulesConfigurationType `json:"RulesConfiguration,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rolemapping.html#cfn-cognito-identitypoolroleattachment-rolemapping-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPoolRoleAttachment_RoleMapping) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPoolRoleAttachment.RoleMapping" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoIdentityPoolRoleAttachment_RoleMapping) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_rulesconfigurationtype.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_rulesconfigurationtype.go new file mode 100644 index 0000000000..6ac3a5b9e7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_rulesconfigurationtype.go @@ -0,0 +1,16 @@ +package cloudformation + +// AWSCognitoIdentityPoolRoleAttachment_RulesConfigurationType AWS CloudFormation Resource (AWS::Cognito::IdentityPoolRoleAttachment.RulesConfigurationType) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rulesconfigurationtype.html +type AWSCognitoIdentityPoolRoleAttachment_RulesConfigurationType struct { +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPoolRoleAttachment_RulesConfigurationType) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPoolRoleAttachment.RulesConfigurationType" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoIdentityPoolRoleAttachment_RulesConfigurationType) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool.go new file mode 100644 index 0000000000..cf88622579 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool.go @@ -0,0 +1,190 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCognitoUserPool AWS CloudFormation Resource (AWS::Cognito::UserPool) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html +type AWSCognitoUserPool struct { + + // AdminCreateUserConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-admincreateuserconfig + AdminCreateUserConfig *AWSCognitoUserPool_AdminCreateUserConfig `json:"AdminCreateUserConfig,omitempty"` + + // AliasAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-aliasattributes + AliasAttributes []string `json:"AliasAttributes,omitempty"` + + // AutoVerifiedAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-autoverifiedattributes + AutoVerifiedAttributes []string `json:"AutoVerifiedAttributes,omitempty"` + + // DeviceConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-deviceconfiguration + DeviceConfiguration *AWSCognitoUserPool_DeviceConfiguration `json:"DeviceConfiguration,omitempty"` + + // EmailConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-emailconfiguration + EmailConfiguration *AWSCognitoUserPool_EmailConfiguration `json:"EmailConfiguration,omitempty"` + + // EmailVerificationMessage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-emailverificationmessage + EmailVerificationMessage string `json:"EmailVerificationMessage,omitempty"` + + // EmailVerificationSubject AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-emailverificationsubject + EmailVerificationSubject string `json:"EmailVerificationSubject,omitempty"` + + // LambdaConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-lambdaconfig + LambdaConfig *AWSCognitoUserPool_LambdaConfig `json:"LambdaConfig,omitempty"` + + // MfaConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-mfaconfiguration + MfaConfiguration string `json:"MfaConfiguration,omitempty"` + + // Policies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-policies + Policies *AWSCognitoUserPool_Policies `json:"Policies,omitempty"` + + // Schema AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-schema + Schema []AWSCognitoUserPool_SchemaAttribute `json:"Schema,omitempty"` + + // SmsAuthenticationMessage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsauthenticationmessage + SmsAuthenticationMessage string `json:"SmsAuthenticationMessage,omitempty"` + + // SmsConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsconfiguration + SmsConfiguration *AWSCognitoUserPool_SmsConfiguration `json:"SmsConfiguration,omitempty"` + + // SmsVerificationMessage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsverificationmessage + SmsVerificationMessage string `json:"SmsVerificationMessage,omitempty"` + + // UserPoolName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-userpoolname + UserPoolName string `json:"UserPoolName,omitempty"` + + // UserPoolTags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-userpooltags + UserPoolTags interface{} `json:"UserPoolTags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCognitoUserPool) MarshalJSON() ([]byte, error) { + type Properties AWSCognitoUserPool + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCognitoUserPool) UnmarshalJSON(b []byte) error { + type Properties AWSCognitoUserPool + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCognitoUserPool(*res.Properties) + } + + return nil +} + +// GetAllAWSCognitoUserPoolResources retrieves all AWSCognitoUserPool items from an AWS CloudFormation template +func (t *Template) GetAllAWSCognitoUserPoolResources() map[string]AWSCognitoUserPool { + results := map[string]AWSCognitoUserPool{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCognitoUserPool: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPool" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPool + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCognitoUserPoolWithName retrieves all AWSCognitoUserPool items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCognitoUserPoolWithName(name string) (AWSCognitoUserPool, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCognitoUserPool: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPool" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPool + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCognitoUserPool{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_admincreateuserconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_admincreateuserconfig.go new file mode 100644 index 0000000000..738d9e92b2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_admincreateuserconfig.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCognitoUserPool_AdminCreateUserConfig AWS CloudFormation Resource (AWS::Cognito::UserPool.AdminCreateUserConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-admincreateuserconfig.html +type AWSCognitoUserPool_AdminCreateUserConfig struct { + + // AllowAdminCreateUserOnly AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-admincreateuserconfig.html#cfn-cognito-userpool-admincreateuserconfig-allowadmincreateuseronly + AllowAdminCreateUserOnly bool `json:"AllowAdminCreateUserOnly,omitempty"` + + // InviteMessageTemplate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-admincreateuserconfig.html#cfn-cognito-userpool-admincreateuserconfig-invitemessagetemplate + InviteMessageTemplate *AWSCognitoUserPool_InviteMessageTemplate `json:"InviteMessageTemplate,omitempty"` + + // UnusedAccountValidityDays AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-admincreateuserconfig.html#cfn-cognito-userpool-admincreateuserconfig-unusedaccountvaliditydays + UnusedAccountValidityDays float64 `json:"UnusedAccountValidityDays,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_AdminCreateUserConfig) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.AdminCreateUserConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_AdminCreateUserConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_deviceconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_deviceconfiguration.go new file mode 100644 index 0000000000..eec22eab62 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_deviceconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCognitoUserPool_DeviceConfiguration AWS CloudFormation Resource (AWS::Cognito::UserPool.DeviceConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-deviceconfiguration.html +type AWSCognitoUserPool_DeviceConfiguration struct { + + // ChallengeRequiredOnNewDevice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-deviceconfiguration.html#cfn-cognito-userpool-deviceconfiguration-challengerequiredonnewdevice + ChallengeRequiredOnNewDevice bool `json:"ChallengeRequiredOnNewDevice,omitempty"` + + // DeviceOnlyRememberedOnUserPrompt AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-deviceconfiguration.html#cfn-cognito-userpool-deviceconfiguration-deviceonlyrememberedonuserprompt + DeviceOnlyRememberedOnUserPrompt bool `json:"DeviceOnlyRememberedOnUserPrompt,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_DeviceConfiguration) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.DeviceConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_DeviceConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_emailconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_emailconfiguration.go new file mode 100644 index 0000000000..07a2b337b5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_emailconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCognitoUserPool_EmailConfiguration AWS CloudFormation Resource (AWS::Cognito::UserPool.EmailConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-emailconfiguration.html +type AWSCognitoUserPool_EmailConfiguration struct { + + // ReplyToEmailAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-emailconfiguration.html#cfn-cognito-userpool-emailconfiguration-replytoemailaddress + ReplyToEmailAddress string `json:"ReplyToEmailAddress,omitempty"` + + // SourceArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-emailconfiguration.html#cfn-cognito-userpool-emailconfiguration-sourcearn + SourceArn string `json:"SourceArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_EmailConfiguration) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.EmailConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_EmailConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_invitemessagetemplate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_invitemessagetemplate.go new file mode 100644 index 0000000000..3808439ffd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_invitemessagetemplate.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSCognitoUserPool_InviteMessageTemplate AWS CloudFormation Resource (AWS::Cognito::UserPool.InviteMessageTemplate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-invitemessagetemplate.html +type AWSCognitoUserPool_InviteMessageTemplate struct { + + // EmailMessage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-invitemessagetemplate.html#cfn-cognito-userpool-invitemessagetemplate-emailmessage + EmailMessage string `json:"EmailMessage,omitempty"` + + // EmailSubject AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-invitemessagetemplate.html#cfn-cognito-userpool-invitemessagetemplate-emailsubject + EmailSubject string `json:"EmailSubject,omitempty"` + + // SMSMessage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-invitemessagetemplate.html#cfn-cognito-userpool-invitemessagetemplate-smsmessage + SMSMessage string `json:"SMSMessage,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_InviteMessageTemplate) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.InviteMessageTemplate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_InviteMessageTemplate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_lambdaconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_lambdaconfig.go new file mode 100644 index 0000000000..f3081ac7ce --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_lambdaconfig.go @@ -0,0 +1,56 @@ +package cloudformation + +// AWSCognitoUserPool_LambdaConfig AWS CloudFormation Resource (AWS::Cognito::UserPool.LambdaConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html +type AWSCognitoUserPool_LambdaConfig struct { + + // CreateAuthChallenge AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-createauthchallenge + CreateAuthChallenge string `json:"CreateAuthChallenge,omitempty"` + + // CustomMessage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-custommessage + CustomMessage string `json:"CustomMessage,omitempty"` + + // DefineAuthChallenge AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-defineauthchallenge + DefineAuthChallenge string `json:"DefineAuthChallenge,omitempty"` + + // PostAuthentication AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-postauthentication + PostAuthentication string `json:"PostAuthentication,omitempty"` + + // PostConfirmation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-postconfirmation + PostConfirmation string `json:"PostConfirmation,omitempty"` + + // PreAuthentication AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-preauthentication + PreAuthentication string `json:"PreAuthentication,omitempty"` + + // PreSignUp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-presignup + PreSignUp string `json:"PreSignUp,omitempty"` + + // VerifyAuthChallengeResponse AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-verifyauthchallengeresponse + VerifyAuthChallengeResponse string `json:"VerifyAuthChallengeResponse,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_LambdaConfig) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.LambdaConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_LambdaConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_numberattributeconstraints.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_numberattributeconstraints.go new file mode 100644 index 0000000000..e26d114fec --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_numberattributeconstraints.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCognitoUserPool_NumberAttributeConstraints AWS CloudFormation Resource (AWS::Cognito::UserPool.NumberAttributeConstraints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-numberattributeconstraints.html +type AWSCognitoUserPool_NumberAttributeConstraints struct { + + // MaxValue AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-numberattributeconstraints.html#cfn-cognito-userpool-numberattributeconstraints-maxvalue + MaxValue string `json:"MaxValue,omitempty"` + + // MinValue AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-numberattributeconstraints.html#cfn-cognito-userpool-numberattributeconstraints-minvalue + MinValue string `json:"MinValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_NumberAttributeConstraints) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.NumberAttributeConstraints" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_NumberAttributeConstraints) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_passwordpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_passwordpolicy.go new file mode 100644 index 0000000000..1ae5d06108 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_passwordpolicy.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSCognitoUserPool_PasswordPolicy AWS CloudFormation Resource (AWS::Cognito::UserPool.PasswordPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-passwordpolicy.html +type AWSCognitoUserPool_PasswordPolicy struct { + + // MinimumLength AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-passwordpolicy.html#cfn-cognito-userpool-passwordpolicy-minimumlength + MinimumLength int `json:"MinimumLength,omitempty"` + + // RequireLowercase AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-passwordpolicy.html#cfn-cognito-userpool-passwordpolicy-requirelowercase + RequireLowercase bool `json:"RequireLowercase,omitempty"` + + // RequireNumbers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-passwordpolicy.html#cfn-cognito-userpool-passwordpolicy-requirenumbers + RequireNumbers bool `json:"RequireNumbers,omitempty"` + + // RequireSymbols AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-passwordpolicy.html#cfn-cognito-userpool-passwordpolicy-requiresymbols + RequireSymbols bool `json:"RequireSymbols,omitempty"` + + // RequireUppercase AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-passwordpolicy.html#cfn-cognito-userpool-passwordpolicy-requireuppercase + RequireUppercase bool `json:"RequireUppercase,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_PasswordPolicy) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.PasswordPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_PasswordPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_policies.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_policies.go new file mode 100644 index 0000000000..52c069c2a8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_policies.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSCognitoUserPool_Policies AWS CloudFormation Resource (AWS::Cognito::UserPool.Policies) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-policies.html +type AWSCognitoUserPool_Policies struct { + + // PasswordPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-policies.html#cfn-cognito-userpool-policies-passwordpolicy + PasswordPolicy *AWSCognitoUserPool_PasswordPolicy `json:"PasswordPolicy,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_Policies) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.Policies" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_Policies) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_schemaattribute.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_schemaattribute.go new file mode 100644 index 0000000000..791addf844 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_schemaattribute.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSCognitoUserPool_SchemaAttribute AWS CloudFormation Resource (AWS::Cognito::UserPool.SchemaAttribute) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html +type AWSCognitoUserPool_SchemaAttribute struct { + + // AttributeDataType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito-userpool-schemaattribute-attributedatatype + AttributeDataType string `json:"AttributeDataType,omitempty"` + + // DeveloperOnlyAttribute AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito-userpool-schemaattribute-developeronlyattribute + DeveloperOnlyAttribute bool `json:"DeveloperOnlyAttribute,omitempty"` + + // Mutable AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito-userpool-schemaattribute-mutable + Mutable bool `json:"Mutable,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito-userpool-schemaattribute-name + Name string `json:"Name,omitempty"` + + // NumberAttributeConstraints AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito-userpool-schemaattribute-numberattributeconstraints + NumberAttributeConstraints *AWSCognitoUserPool_NumberAttributeConstraints `json:"NumberAttributeConstraints,omitempty"` + + // Required AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito-userpool-schemaattribute-required + Required bool `json:"Required,omitempty"` + + // StringAttributeConstraints AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-schemaattribute.html#cfn-cognito-userpool-schemaattribute-stringattributeconstraints + StringAttributeConstraints *AWSCognitoUserPool_StringAttributeConstraints `json:"StringAttributeConstraints,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_SchemaAttribute) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.SchemaAttribute" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_SchemaAttribute) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_smsconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_smsconfiguration.go new file mode 100644 index 0000000000..e13cba3e84 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_smsconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCognitoUserPool_SmsConfiguration AWS CloudFormation Resource (AWS::Cognito::UserPool.SmsConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-smsconfiguration.html +type AWSCognitoUserPool_SmsConfiguration struct { + + // ExternalId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-smsconfiguration.html#cfn-cognito-userpool-smsconfiguration-externalid + ExternalId string `json:"ExternalId,omitempty"` + + // SnsCallerArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-smsconfiguration.html#cfn-cognito-userpool-smsconfiguration-snscallerarn + SnsCallerArn string `json:"SnsCallerArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_SmsConfiguration) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.SmsConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_SmsConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_stringattributeconstraints.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_stringattributeconstraints.go new file mode 100644 index 0000000000..ff01d84634 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_stringattributeconstraints.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCognitoUserPool_StringAttributeConstraints AWS CloudFormation Resource (AWS::Cognito::UserPool.StringAttributeConstraints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-stringattributeconstraints.html +type AWSCognitoUserPool_StringAttributeConstraints struct { + + // MaxLength AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-stringattributeconstraints.html#cfn-cognito-userpool-stringattributeconstraints-maxlength + MaxLength string `json:"MaxLength,omitempty"` + + // MinLength AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-stringattributeconstraints.html#cfn-cognito-userpool-stringattributeconstraints-minlength + MinLength string `json:"MinLength,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_StringAttributeConstraints) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.StringAttributeConstraints" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPool_StringAttributeConstraints) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolclient.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolclient.go new file mode 100644 index 0000000000..be6854ee62 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolclient.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCognitoUserPoolClient AWS CloudFormation Resource (AWS::Cognito::UserPoolClient) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html +type AWSCognitoUserPoolClient struct { + + // ClientName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-clientname + ClientName string `json:"ClientName,omitempty"` + + // ExplicitAuthFlows AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-explicitauthflows + ExplicitAuthFlows []string `json:"ExplicitAuthFlows,omitempty"` + + // GenerateSecret AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-generatesecret + GenerateSecret bool `json:"GenerateSecret,omitempty"` + + // ReadAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-readattributes + ReadAttributes []string `json:"ReadAttributes,omitempty"` + + // RefreshTokenValidity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-refreshtokenvalidity + RefreshTokenValidity float64 `json:"RefreshTokenValidity,omitempty"` + + // UserPoolId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-userpoolid + UserPoolId string `json:"UserPoolId,omitempty"` + + // WriteAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-writeattributes + WriteAttributes []string `json:"WriteAttributes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolClient) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolClient" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPoolClient) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCognitoUserPoolClient) MarshalJSON() ([]byte, error) { + type Properties AWSCognitoUserPoolClient + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCognitoUserPoolClient) UnmarshalJSON(b []byte) error { + type Properties AWSCognitoUserPoolClient + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCognitoUserPoolClient(*res.Properties) + } + + return nil +} + +// GetAllAWSCognitoUserPoolClientResources retrieves all AWSCognitoUserPoolClient items from an AWS CloudFormation template +func (t *Template) GetAllAWSCognitoUserPoolClientResources() map[string]AWSCognitoUserPoolClient { + results := map[string]AWSCognitoUserPoolClient{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCognitoUserPoolClient: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPoolClient" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPoolClient + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCognitoUserPoolClientWithName retrieves all AWSCognitoUserPoolClient items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCognitoUserPoolClientWithName(name string) (AWSCognitoUserPoolClient, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCognitoUserPoolClient: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPoolClient" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPoolClient + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCognitoUserPoolClient{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolgroup.go new file mode 100644 index 0000000000..37dd083ffe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolgroup.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCognitoUserPoolGroup AWS CloudFormation Resource (AWS::Cognito::UserPoolGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html +type AWSCognitoUserPoolGroup struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html#cfn-cognito-userpoolgroup-description + Description string `json:"Description,omitempty"` + + // GroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html#cfn-cognito-userpoolgroup-groupname + GroupName string `json:"GroupName,omitempty"` + + // Precedence AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html#cfn-cognito-userpoolgroup-precedence + Precedence float64 `json:"Precedence,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html#cfn-cognito-userpoolgroup-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // UserPoolId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html#cfn-cognito-userpoolgroup-userpoolid + UserPoolId string `json:"UserPoolId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolGroup) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPoolGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCognitoUserPoolGroup) MarshalJSON() ([]byte, error) { + type Properties AWSCognitoUserPoolGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCognitoUserPoolGroup) UnmarshalJSON(b []byte) error { + type Properties AWSCognitoUserPoolGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCognitoUserPoolGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSCognitoUserPoolGroupResources retrieves all AWSCognitoUserPoolGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSCognitoUserPoolGroupResources() map[string]AWSCognitoUserPoolGroup { + results := map[string]AWSCognitoUserPoolGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCognitoUserPoolGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPoolGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPoolGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCognitoUserPoolGroupWithName retrieves all AWSCognitoUserPoolGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCognitoUserPoolGroupWithName(name string) (AWSCognitoUserPoolGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCognitoUserPoolGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPoolGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPoolGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCognitoUserPoolGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpooluser.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpooluser.go new file mode 100644 index 0000000000..fb10dddc20 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpooluser.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCognitoUserPoolUser AWS CloudFormation Resource (AWS::Cognito::UserPoolUser) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html +type AWSCognitoUserPoolUser struct { + + // DesiredDeliveryMediums AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html#cfn-cognito-userpooluser-desireddeliverymediums + DesiredDeliveryMediums []string `json:"DesiredDeliveryMediums,omitempty"` + + // ForceAliasCreation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html#cfn-cognito-userpooluser-forcealiascreation + ForceAliasCreation bool `json:"ForceAliasCreation,omitempty"` + + // MessageAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html#cfn-cognito-userpooluser-messageaction + MessageAction string `json:"MessageAction,omitempty"` + + // UserAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html#cfn-cognito-userpooluser-userattributes + UserAttributes []AWSCognitoUserPoolUser_AttributeType `json:"UserAttributes,omitempty"` + + // UserPoolId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html#cfn-cognito-userpooluser-userpoolid + UserPoolId string `json:"UserPoolId,omitempty"` + + // Username AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html#cfn-cognito-userpooluser-username + Username string `json:"Username,omitempty"` + + // ValidationData AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpooluser.html#cfn-cognito-userpooluser-validationdata + ValidationData []AWSCognitoUserPoolUser_AttributeType `json:"ValidationData,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolUser) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolUser" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPoolUser) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCognitoUserPoolUser) MarshalJSON() ([]byte, error) { + type Properties AWSCognitoUserPoolUser + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCognitoUserPoolUser) UnmarshalJSON(b []byte) error { + type Properties AWSCognitoUserPoolUser + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCognitoUserPoolUser(*res.Properties) + } + + return nil +} + +// GetAllAWSCognitoUserPoolUserResources retrieves all AWSCognitoUserPoolUser items from an AWS CloudFormation template +func (t *Template) GetAllAWSCognitoUserPoolUserResources() map[string]AWSCognitoUserPoolUser { + results := map[string]AWSCognitoUserPoolUser{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCognitoUserPoolUser: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPoolUser" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPoolUser + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCognitoUserPoolUserWithName retrieves all AWSCognitoUserPoolUser items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCognitoUserPoolUserWithName(name string) (AWSCognitoUserPoolUser, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCognitoUserPoolUser: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPoolUser" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPoolUser + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCognitoUserPoolUser{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpooluser_attributetype.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpooluser_attributetype.go new file mode 100644 index 0000000000..04100dbbb3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpooluser_attributetype.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSCognitoUserPoolUser_AttributeType AWS CloudFormation Resource (AWS::Cognito::UserPoolUser.AttributeType) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpooluser-attributetype.html +type AWSCognitoUserPoolUser_AttributeType struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpooluser-attributetype.html#cfn-cognito-userpooluser-attributetype-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpooluser-attributetype.html#cfn-cognito-userpooluser-attributetype-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolUser_AttributeType) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolUser.AttributeType" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPoolUser_AttributeType) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolusertogroupattachment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolusertogroupattachment.go new file mode 100644 index 0000000000..4351f86938 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolusertogroupattachment.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCognitoUserPoolUserToGroupAttachment AWS CloudFormation Resource (AWS::Cognito::UserPoolUserToGroupAttachment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolusertogroupattachment.html +type AWSCognitoUserPoolUserToGroupAttachment struct { + + // GroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolusertogroupattachment.html#cfn-cognito-userpoolusertogroupattachment-groupname + GroupName string `json:"GroupName,omitempty"` + + // UserPoolId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolusertogroupattachment.html#cfn-cognito-userpoolusertogroupattachment-userpoolid + UserPoolId string `json:"UserPoolId,omitempty"` + + // Username AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolusertogroupattachment.html#cfn-cognito-userpoolusertogroupattachment-username + Username string `json:"Username,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolUserToGroupAttachment) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolUserToGroupAttachment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSCognitoUserPoolUserToGroupAttachment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSCognitoUserPoolUserToGroupAttachment) MarshalJSON() ([]byte, error) { + type Properties AWSCognitoUserPoolUserToGroupAttachment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCognitoUserPoolUserToGroupAttachment) UnmarshalJSON(b []byte) error { + type Properties AWSCognitoUserPoolUserToGroupAttachment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSCognitoUserPoolUserToGroupAttachment(*res.Properties) + } + + return nil +} + +// GetAllAWSCognitoUserPoolUserToGroupAttachmentResources retrieves all AWSCognitoUserPoolUserToGroupAttachment items from an AWS CloudFormation template +func (t *Template) GetAllAWSCognitoUserPoolUserToGroupAttachmentResources() map[string]AWSCognitoUserPoolUserToGroupAttachment { + results := map[string]AWSCognitoUserPoolUserToGroupAttachment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCognitoUserPoolUserToGroupAttachment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPoolUserToGroupAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPoolUserToGroupAttachment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCognitoUserPoolUserToGroupAttachmentWithName retrieves all AWSCognitoUserPoolUserToGroupAttachment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCognitoUserPoolUserToGroupAttachmentWithName(name string) (AWSCognitoUserPoolUserToGroupAttachment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCognitoUserPoolUserToGroupAttachment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Cognito::UserPoolUserToGroupAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCognitoUserPoolUserToGroupAttachment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCognitoUserPoolUserToGroupAttachment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule.go new file mode 100644 index 0000000000..137d98996d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSConfigConfigRule AWS CloudFormation Resource (AWS::Config::ConfigRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html +type AWSConfigConfigRule struct { + + // ConfigRuleName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html#cfn-config-configrule-configrulename + ConfigRuleName string `json:"ConfigRuleName,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html#cfn-config-configrule-description + Description string `json:"Description,omitempty"` + + // InputParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html#cfn-config-configrule-inputparameters + InputParameters interface{} `json:"InputParameters,omitempty"` + + // MaximumExecutionFrequency AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html#cfn-config-configrule-maximumexecutionfrequency + MaximumExecutionFrequency string `json:"MaximumExecutionFrequency,omitempty"` + + // Scope AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html#cfn-config-configrule-scope + Scope *AWSConfigConfigRule_Scope `json:"Scope,omitempty"` + + // Source AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html#cfn-config-configrule-source + Source *AWSConfigConfigRule_Source `json:"Source,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigRule) AWSCloudFormationType() string { + return "AWS::Config::ConfigRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSConfigConfigRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSConfigConfigRule) MarshalJSON() ([]byte, error) { + type Properties AWSConfigConfigRule + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSConfigConfigRule) UnmarshalJSON(b []byte) error { + type Properties AWSConfigConfigRule + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSConfigConfigRule(*res.Properties) + } + + return nil +} + +// GetAllAWSConfigConfigRuleResources retrieves all AWSConfigConfigRule items from an AWS CloudFormation template +func (t *Template) GetAllAWSConfigConfigRuleResources() map[string]AWSConfigConfigRule { + results := map[string]AWSConfigConfigRule{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSConfigConfigRule: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Config::ConfigRule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigConfigRule + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSConfigConfigRuleWithName retrieves all AWSConfigConfigRule items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSConfigConfigRuleWithName(name string) (AWSConfigConfigRule, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSConfigConfigRule: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Config::ConfigRule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigConfigRule + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSConfigConfigRule{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_scope.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_scope.go new file mode 100644 index 0000000000..6bcfaf7a5f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_scope.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSConfigConfigRule_Scope AWS CloudFormation Resource (AWS::Config::ConfigRule.Scope) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-scope.html +type AWSConfigConfigRule_Scope struct { + + // ComplianceResourceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-scope.html#cfn-config-configrule-scope-complianceresourceid + ComplianceResourceId string `json:"ComplianceResourceId,omitempty"` + + // ComplianceResourceTypes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-scope.html#cfn-config-configrule-scope-complianceresourcetypes + ComplianceResourceTypes []string `json:"ComplianceResourceTypes,omitempty"` + + // TagKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-scope.html#cfn-config-configrule-scope-tagkey + TagKey string `json:"TagKey,omitempty"` + + // TagValue AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-scope.html#cfn-config-configrule-scope-tagvalue + TagValue string `json:"TagValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigRule_Scope) AWSCloudFormationType() string { + return "AWS::Config::ConfigRule.Scope" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSConfigConfigRule_Scope) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_source.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_source.go new file mode 100644 index 0000000000..db4763a99e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_source.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSConfigConfigRule_Source AWS CloudFormation Resource (AWS::Config::ConfigRule.Source) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-source.html +type AWSConfigConfigRule_Source struct { + + // Owner AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-source.html#cfn-config-configrule-source-owner + Owner string `json:"Owner,omitempty"` + + // SourceDetails AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-source.html#cfn-config-configrule-source-sourcedetails + SourceDetails []AWSConfigConfigRule_SourceDetail `json:"SourceDetails,omitempty"` + + // SourceIdentifier AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-source.html#cfn-config-configrule-source-sourceidentifier + SourceIdentifier string `json:"SourceIdentifier,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigRule_Source) AWSCloudFormationType() string { + return "AWS::Config::ConfigRule.Source" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSConfigConfigRule_Source) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_sourcedetail.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_sourcedetail.go new file mode 100644 index 0000000000..34157ff096 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_sourcedetail.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSConfigConfigRule_SourceDetail AWS CloudFormation Resource (AWS::Config::ConfigRule.SourceDetail) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-source-sourcedetails.html +type AWSConfigConfigRule_SourceDetail struct { + + // EventSource AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-source-sourcedetails.html#cfn-config-configrule-source-sourcedetail-eventsource + EventSource string `json:"EventSource,omitempty"` + + // MaximumExecutionFrequency AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-source-sourcedetails.html#cfn-config-configrule-sourcedetail-maximumexecutionfrequency + MaximumExecutionFrequency string `json:"MaximumExecutionFrequency,omitempty"` + + // MessageType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configrule-source-sourcedetails.html#cfn-config-configrule-source-sourcedetail-messagetype + MessageType string `json:"MessageType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigRule_SourceDetail) AWSCloudFormationType() string { + return "AWS::Config::ConfigRule.SourceDetail" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSConfigConfigRule_SourceDetail) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationrecorder.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationrecorder.go new file mode 100644 index 0000000000..a160edc3c0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationrecorder.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSConfigConfigurationRecorder AWS CloudFormation Resource (AWS::Config::ConfigurationRecorder) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configurationrecorder.html +type AWSConfigConfigurationRecorder struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configurationrecorder.html#cfn-config-configurationrecorder-name + Name string `json:"Name,omitempty"` + + // RecordingGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configurationrecorder.html#cfn-config-configurationrecorder-recordinggroup + RecordingGroup *AWSConfigConfigurationRecorder_RecordingGroup `json:"RecordingGroup,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configurationrecorder.html#cfn-config-configurationrecorder-rolearn + RoleARN string `json:"RoleARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigurationRecorder) AWSCloudFormationType() string { + return "AWS::Config::ConfigurationRecorder" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSConfigConfigurationRecorder) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSConfigConfigurationRecorder) MarshalJSON() ([]byte, error) { + type Properties AWSConfigConfigurationRecorder + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSConfigConfigurationRecorder) UnmarshalJSON(b []byte) error { + type Properties AWSConfigConfigurationRecorder + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSConfigConfigurationRecorder(*res.Properties) + } + + return nil +} + +// GetAllAWSConfigConfigurationRecorderResources retrieves all AWSConfigConfigurationRecorder items from an AWS CloudFormation template +func (t *Template) GetAllAWSConfigConfigurationRecorderResources() map[string]AWSConfigConfigurationRecorder { + results := map[string]AWSConfigConfigurationRecorder{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSConfigConfigurationRecorder: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Config::ConfigurationRecorder" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigConfigurationRecorder + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSConfigConfigurationRecorderWithName retrieves all AWSConfigConfigurationRecorder items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSConfigConfigurationRecorderWithName(name string) (AWSConfigConfigurationRecorder, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSConfigConfigurationRecorder: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Config::ConfigurationRecorder" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigConfigurationRecorder + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSConfigConfigurationRecorder{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationrecorder_recordinggroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationrecorder_recordinggroup.go new file mode 100644 index 0000000000..1e37b83584 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationrecorder_recordinggroup.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSConfigConfigurationRecorder_RecordingGroup AWS CloudFormation Resource (AWS::Config::ConfigurationRecorder.RecordingGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationrecorder-recordinggroup.html +type AWSConfigConfigurationRecorder_RecordingGroup struct { + + // AllSupported AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationrecorder-recordinggroup.html#cfn-config-configurationrecorder-recordinggroup-allsupported + AllSupported bool `json:"AllSupported,omitempty"` + + // IncludeGlobalResourceTypes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationrecorder-recordinggroup.html#cfn-config-configurationrecorder-recordinggroup-includeglobalresourcetypes + IncludeGlobalResourceTypes bool `json:"IncludeGlobalResourceTypes,omitempty"` + + // ResourceTypes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationrecorder-recordinggroup.html#cfn-config-configurationrecorder-recordinggroup-resourcetypes + ResourceTypes []string `json:"ResourceTypes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigurationRecorder_RecordingGroup) AWSCloudFormationType() string { + return "AWS::Config::ConfigurationRecorder.RecordingGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSConfigConfigurationRecorder_RecordingGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-deliverychannel.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-deliverychannel.go new file mode 100644 index 0000000000..3096936767 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-deliverychannel.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSConfigDeliveryChannel AWS CloudFormation Resource (AWS::Config::DeliveryChannel) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-deliverychannel.html +type AWSConfigDeliveryChannel struct { + + // ConfigSnapshotDeliveryProperties AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-deliverychannel.html#cfn-config-deliverychannel-configsnapshotdeliveryproperties + ConfigSnapshotDeliveryProperties *AWSConfigDeliveryChannel_ConfigSnapshotDeliveryProperties `json:"ConfigSnapshotDeliveryProperties,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-deliverychannel.html#cfn-config-deliverychannel-name + Name string `json:"Name,omitempty"` + + // S3BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-deliverychannel.html#cfn-config-deliverychannel-s3bucketname + S3BucketName string `json:"S3BucketName,omitempty"` + + // S3KeyPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-deliverychannel.html#cfn-config-deliverychannel-s3keyprefix + S3KeyPrefix string `json:"S3KeyPrefix,omitempty"` + + // SnsTopicARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-deliverychannel.html#cfn-config-deliverychannel-snstopicarn + SnsTopicARN string `json:"SnsTopicARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigDeliveryChannel) AWSCloudFormationType() string { + return "AWS::Config::DeliveryChannel" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSConfigDeliveryChannel) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSConfigDeliveryChannel) MarshalJSON() ([]byte, error) { + type Properties AWSConfigDeliveryChannel + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSConfigDeliveryChannel) UnmarshalJSON(b []byte) error { + type Properties AWSConfigDeliveryChannel + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSConfigDeliveryChannel(*res.Properties) + } + + return nil +} + +// GetAllAWSConfigDeliveryChannelResources retrieves all AWSConfigDeliveryChannel items from an AWS CloudFormation template +func (t *Template) GetAllAWSConfigDeliveryChannelResources() map[string]AWSConfigDeliveryChannel { + results := map[string]AWSConfigDeliveryChannel{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSConfigDeliveryChannel: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Config::DeliveryChannel" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigDeliveryChannel + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSConfigDeliveryChannelWithName retrieves all AWSConfigDeliveryChannel items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSConfigDeliveryChannelWithName(name string) (AWSConfigDeliveryChannel, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSConfigDeliveryChannel: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Config::DeliveryChannel" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigDeliveryChannel + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSConfigDeliveryChannel{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-deliverychannel_configsnapshotdeliveryproperties.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-deliverychannel_configsnapshotdeliveryproperties.go new file mode 100644 index 0000000000..27e864f39b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-deliverychannel_configsnapshotdeliveryproperties.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSConfigDeliveryChannel_ConfigSnapshotDeliveryProperties AWS CloudFormation Resource (AWS::Config::DeliveryChannel.ConfigSnapshotDeliveryProperties) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-deliverychannel-configsnapshotdeliveryproperties.html +type AWSConfigDeliveryChannel_ConfigSnapshotDeliveryProperties struct { + + // DeliveryFrequency AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-deliverychannel-configsnapshotdeliveryproperties.html#cfn-config-deliverychannel-configsnapshotdeliveryproperties-deliveryfrequency + DeliveryFrequency string `json:"DeliveryFrequency,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigDeliveryChannel_ConfigSnapshotDeliveryProperties) AWSCloudFormationType() string { + return "AWS::Config::DeliveryChannel.ConfigSnapshotDeliveryProperties" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSConfigDeliveryChannel_ConfigSnapshotDeliveryProperties) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline.go new file mode 100644 index 0000000000..aadbe55360 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDataPipelinePipeline AWS CloudFormation Resource (AWS::DataPipeline::Pipeline) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html +type AWSDataPipelinePipeline struct { + + // Activate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html#cfn-datapipeline-pipeline-activate + Activate bool `json:"Activate,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html#cfn-datapipeline-pipeline-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html#cfn-datapipeline-pipeline-name + Name string `json:"Name,omitempty"` + + // ParameterObjects AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html#cfn-datapipeline-pipeline-parameterobjects + ParameterObjects []AWSDataPipelinePipeline_ParameterObject `json:"ParameterObjects,omitempty"` + + // ParameterValues AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html#cfn-datapipeline-pipeline-parametervalues + ParameterValues []AWSDataPipelinePipeline_ParameterValue `json:"ParameterValues,omitempty"` + + // PipelineObjects AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html#cfn-datapipeline-pipeline-pipelineobjects + PipelineObjects []AWSDataPipelinePipeline_PipelineObject `json:"PipelineObjects,omitempty"` + + // PipelineTags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html#cfn-datapipeline-pipeline-pipelinetags + PipelineTags []AWSDataPipelinePipeline_PipelineTag `json:"PipelineTags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDataPipelinePipeline) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDataPipelinePipeline) MarshalJSON() ([]byte, error) { + type Properties AWSDataPipelinePipeline + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDataPipelinePipeline) UnmarshalJSON(b []byte) error { + type Properties AWSDataPipelinePipeline + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDataPipelinePipeline(*res.Properties) + } + + return nil +} + +// GetAllAWSDataPipelinePipelineResources retrieves all AWSDataPipelinePipeline items from an AWS CloudFormation template +func (t *Template) GetAllAWSDataPipelinePipelineResources() map[string]AWSDataPipelinePipeline { + results := map[string]AWSDataPipelinePipeline{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDataPipelinePipeline: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DataPipeline::Pipeline" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDataPipelinePipeline + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDataPipelinePipelineWithName retrieves all AWSDataPipelinePipeline items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDataPipelinePipelineWithName(name string) (AWSDataPipelinePipeline, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDataPipelinePipeline: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DataPipeline::Pipeline" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDataPipelinePipeline + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDataPipelinePipeline{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_field.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_field.go new file mode 100644 index 0000000000..1aea9b9129 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_field.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSDataPipelinePipeline_Field AWS CloudFormation Resource (AWS::DataPipeline::Pipeline.Field) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelineobjects-fields.html +type AWSDataPipelinePipeline_Field struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelineobjects-fields.html#cfn-datapipeline-pipeline-pipelineobjects-fields-key + Key string `json:"Key,omitempty"` + + // RefValue AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelineobjects-fields.html#cfn-datapipeline-pipeline-pipelineobjects-fields-refvalue + RefValue string `json:"RefValue,omitempty"` + + // StringValue AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelineobjects-fields.html#cfn-datapipeline-pipeline-pipelineobjects-fields-stringvalue + StringValue string `json:"StringValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_Field) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.Field" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDataPipelinePipeline_Field) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parameterattribute.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parameterattribute.go new file mode 100644 index 0000000000..506921907c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parameterattribute.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDataPipelinePipeline_ParameterAttribute AWS CloudFormation Resource (AWS::DataPipeline::Pipeline.ParameterAttribute) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parameterobjects-attributes.html +type AWSDataPipelinePipeline_ParameterAttribute struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parameterobjects-attributes.html#cfn-datapipeline-pipeline-parameterobjects-attribtues-key + Key string `json:"Key,omitempty"` + + // StringValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parameterobjects-attributes.html#cfn-datapipeline-pipeline-parameterobjects-attribtues-stringvalue + StringValue string `json:"StringValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_ParameterAttribute) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.ParameterAttribute" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDataPipelinePipeline_ParameterAttribute) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parameterobject.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parameterobject.go new file mode 100644 index 0000000000..5229ad5a84 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parameterobject.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDataPipelinePipeline_ParameterObject AWS CloudFormation Resource (AWS::DataPipeline::Pipeline.ParameterObject) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parameterobjects.html +type AWSDataPipelinePipeline_ParameterObject struct { + + // Attributes AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parameterobjects.html#cfn-datapipeline-pipeline-parameterobjects-attributes + Attributes []AWSDataPipelinePipeline_ParameterAttribute `json:"Attributes,omitempty"` + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parameterobjects.html#cfn-datapipeline-pipeline-parameterobject-id + Id string `json:"Id,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_ParameterObject) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.ParameterObject" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDataPipelinePipeline_ParameterObject) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parametervalue.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parametervalue.go new file mode 100644 index 0000000000..5d9c037f85 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parametervalue.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDataPipelinePipeline_ParameterValue AWS CloudFormation Resource (AWS::DataPipeline::Pipeline.ParameterValue) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parametervalues.html +type AWSDataPipelinePipeline_ParameterValue struct { + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parametervalues.html#cfn-datapipeline-pipeline-parametervalues-id + Id string `json:"Id,omitempty"` + + // StringValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-parametervalues.html#cfn-datapipeline-pipeline-parametervalues-stringvalue + StringValue string `json:"StringValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_ParameterValue) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.ParameterValue" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDataPipelinePipeline_ParameterValue) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_pipelineobject.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_pipelineobject.go new file mode 100644 index 0000000000..55220b3a72 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_pipelineobject.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSDataPipelinePipeline_PipelineObject AWS CloudFormation Resource (AWS::DataPipeline::Pipeline.PipelineObject) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelineobjects.html +type AWSDataPipelinePipeline_PipelineObject struct { + + // Fields AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelineobjects.html#cfn-datapipeline-pipeline-pipelineobjects-fields + Fields []AWSDataPipelinePipeline_Field `json:"Fields,omitempty"` + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelineobjects.html#cfn-datapipeline-pipeline-pipelineobjects-id + Id string `json:"Id,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelineobjects.html#cfn-datapipeline-pipeline-pipelineobjects-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_PipelineObject) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.PipelineObject" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDataPipelinePipeline_PipelineObject) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_pipelinetag.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_pipelinetag.go new file mode 100644 index 0000000000..ea2fa31556 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_pipelinetag.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDataPipelinePipeline_PipelineTag AWS CloudFormation Resource (AWS::DataPipeline::Pipeline.PipelineTag) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelinetags.html +type AWSDataPipelinePipeline_PipelineTag struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelinetags.html#cfn-datapipeline-pipeline-pipelinetags-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-datapipeline-pipeline-pipelinetags.html#cfn-datapipeline-pipeline-pipelinetags-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_PipelineTag) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.PipelineTag" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDataPipelinePipeline_PipelineTag) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-microsoftad.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-microsoftad.go new file mode 100644 index 0000000000..b9018ec801 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-microsoftad.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDirectoryServiceMicrosoftAD AWS CloudFormation Resource (AWS::DirectoryService::MicrosoftAD) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-microsoftad.html +type AWSDirectoryServiceMicrosoftAD struct { + + // CreateAlias AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-microsoftad.html#cfn-directoryservice-microsoftad-createalias + CreateAlias bool `json:"CreateAlias,omitempty"` + + // EnableSso AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-microsoftad.html#cfn-directoryservice-microsoftad-enablesso + EnableSso bool `json:"EnableSso,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-microsoftad.html#cfn-directoryservice-microsoftad-name + Name string `json:"Name,omitempty"` + + // Password AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-microsoftad.html#cfn-directoryservice-microsoftad-password + Password string `json:"Password,omitempty"` + + // ShortName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-microsoftad.html#cfn-directoryservice-microsoftad-shortname + ShortName string `json:"ShortName,omitempty"` + + // VpcSettings AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-microsoftad.html#cfn-directoryservice-microsoftad-vpcsettings + VpcSettings *AWSDirectoryServiceMicrosoftAD_VpcSettings `json:"VpcSettings,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDirectoryServiceMicrosoftAD) AWSCloudFormationType() string { + return "AWS::DirectoryService::MicrosoftAD" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDirectoryServiceMicrosoftAD) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDirectoryServiceMicrosoftAD) MarshalJSON() ([]byte, error) { + type Properties AWSDirectoryServiceMicrosoftAD + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDirectoryServiceMicrosoftAD) UnmarshalJSON(b []byte) error { + type Properties AWSDirectoryServiceMicrosoftAD + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDirectoryServiceMicrosoftAD(*res.Properties) + } + + return nil +} + +// GetAllAWSDirectoryServiceMicrosoftADResources retrieves all AWSDirectoryServiceMicrosoftAD items from an AWS CloudFormation template +func (t *Template) GetAllAWSDirectoryServiceMicrosoftADResources() map[string]AWSDirectoryServiceMicrosoftAD { + results := map[string]AWSDirectoryServiceMicrosoftAD{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDirectoryServiceMicrosoftAD: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DirectoryService::MicrosoftAD" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDirectoryServiceMicrosoftAD + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDirectoryServiceMicrosoftADWithName retrieves all AWSDirectoryServiceMicrosoftAD items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDirectoryServiceMicrosoftADWithName(name string) (AWSDirectoryServiceMicrosoftAD, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDirectoryServiceMicrosoftAD: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DirectoryService::MicrosoftAD" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDirectoryServiceMicrosoftAD + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDirectoryServiceMicrosoftAD{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-microsoftad_vpcsettings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-microsoftad_vpcsettings.go new file mode 100644 index 0000000000..be6cb3ac35 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-microsoftad_vpcsettings.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDirectoryServiceMicrosoftAD_VpcSettings AWS CloudFormation Resource (AWS::DirectoryService::MicrosoftAD.VpcSettings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-directoryservice-microsoftad-vpcsettings.html +type AWSDirectoryServiceMicrosoftAD_VpcSettings struct { + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-directoryservice-microsoftad-vpcsettings.html#cfn-directoryservice-microsoftad-vpcsettings-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-directoryservice-microsoftad-vpcsettings.html#cfn-directoryservice-microsoftad-vpcsettings-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDirectoryServiceMicrosoftAD_VpcSettings) AWSCloudFormationType() string { + return "AWS::DirectoryService::MicrosoftAD.VpcSettings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDirectoryServiceMicrosoftAD_VpcSettings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-simplead.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-simplead.go new file mode 100644 index 0000000000..5aaf46b618 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-simplead.go @@ -0,0 +1,150 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDirectoryServiceSimpleAD AWS CloudFormation Resource (AWS::DirectoryService::SimpleAD) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html +type AWSDirectoryServiceSimpleAD struct { + + // CreateAlias AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html#cfn-directoryservice-simplead-createalias + CreateAlias bool `json:"CreateAlias,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html#cfn-directoryservice-simplead-description + Description string `json:"Description,omitempty"` + + // EnableSso AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html#cfn-directoryservice-simplead-enablesso + EnableSso bool `json:"EnableSso,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html#cfn-directoryservice-simplead-name + Name string `json:"Name,omitempty"` + + // Password AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html#cfn-directoryservice-simplead-password + Password string `json:"Password,omitempty"` + + // ShortName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html#cfn-directoryservice-simplead-shortname + ShortName string `json:"ShortName,omitempty"` + + // Size AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html#cfn-directoryservice-simplead-size + Size string `json:"Size,omitempty"` + + // VpcSettings AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-simplead.html#cfn-directoryservice-simplead-vpcsettings + VpcSettings *AWSDirectoryServiceSimpleAD_VpcSettings `json:"VpcSettings,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDirectoryServiceSimpleAD) AWSCloudFormationType() string { + return "AWS::DirectoryService::SimpleAD" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDirectoryServiceSimpleAD) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDirectoryServiceSimpleAD) MarshalJSON() ([]byte, error) { + type Properties AWSDirectoryServiceSimpleAD + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDirectoryServiceSimpleAD) UnmarshalJSON(b []byte) error { + type Properties AWSDirectoryServiceSimpleAD + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDirectoryServiceSimpleAD(*res.Properties) + } + + return nil +} + +// GetAllAWSDirectoryServiceSimpleADResources retrieves all AWSDirectoryServiceSimpleAD items from an AWS CloudFormation template +func (t *Template) GetAllAWSDirectoryServiceSimpleADResources() map[string]AWSDirectoryServiceSimpleAD { + results := map[string]AWSDirectoryServiceSimpleAD{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDirectoryServiceSimpleAD: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DirectoryService::SimpleAD" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDirectoryServiceSimpleAD + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDirectoryServiceSimpleADWithName retrieves all AWSDirectoryServiceSimpleAD items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDirectoryServiceSimpleADWithName(name string) (AWSDirectoryServiceSimpleAD, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDirectoryServiceSimpleAD: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DirectoryService::SimpleAD" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDirectoryServiceSimpleAD + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDirectoryServiceSimpleAD{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-simplead_vpcsettings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-simplead_vpcsettings.go new file mode 100644 index 0000000000..2644305517 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-simplead_vpcsettings.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDirectoryServiceSimpleAD_VpcSettings AWS CloudFormation Resource (AWS::DirectoryService::SimpleAD.VpcSettings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-directoryservice-simplead-vpcsettings.html +type AWSDirectoryServiceSimpleAD_VpcSettings struct { + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-directoryservice-simplead-vpcsettings.html#cfn-directoryservice-simplead-vpcsettings-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-directoryservice-simplead-vpcsettings.html#cfn-directoryservice-simplead-vpcsettings-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDirectoryServiceSimpleAD_VpcSettings) AWSCloudFormationType() string { + return "AWS::DirectoryService::SimpleAD.VpcSettings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDirectoryServiceSimpleAD_VpcSettings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-certificate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-certificate.go new file mode 100644 index 0000000000..eee06627ad --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-certificate.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDMSCertificate AWS CloudFormation Resource (AWS::DMS::Certificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-certificate.html +type AWSDMSCertificate struct { + + // CertificateIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-certificate.html#cfn-dms-certificate-certificateidentifier + CertificateIdentifier string `json:"CertificateIdentifier,omitempty"` + + // CertificatePem AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-certificate.html#cfn-dms-certificate-certificatepem + CertificatePem string `json:"CertificatePem,omitempty"` + + // CertificateWallet AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-certificate.html#cfn-dms-certificate-certificatewallet + CertificateWallet string `json:"CertificateWallet,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSCertificate) AWSCloudFormationType() string { + return "AWS::DMS::Certificate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSCertificate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDMSCertificate) MarshalJSON() ([]byte, error) { + type Properties AWSDMSCertificate + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDMSCertificate) UnmarshalJSON(b []byte) error { + type Properties AWSDMSCertificate + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDMSCertificate(*res.Properties) + } + + return nil +} + +// GetAllAWSDMSCertificateResources retrieves all AWSDMSCertificate items from an AWS CloudFormation template +func (t *Template) GetAllAWSDMSCertificateResources() map[string]AWSDMSCertificate { + results := map[string]AWSDMSCertificate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDMSCertificate: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::Certificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSCertificate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDMSCertificateWithName retrieves all AWSDMSCertificate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDMSCertificateWithName(name string) (AWSDMSCertificate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDMSCertificate: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::Certificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSCertificate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDMSCertificate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint.go new file mode 100644 index 0000000000..72c8b63cc7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint.go @@ -0,0 +1,190 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDMSEndpoint AWS CloudFormation Resource (AWS::DMS::Endpoint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html +type AWSDMSEndpoint struct { + + // CertificateArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-certificatearn + CertificateArn string `json:"CertificateArn,omitempty"` + + // DatabaseName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-databasename + DatabaseName string `json:"DatabaseName,omitempty"` + + // DynamoDbSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-dynamodbsettings + DynamoDbSettings *AWSDMSEndpoint_DynamoDbSettings `json:"DynamoDbSettings,omitempty"` + + // EndpointIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-endpointidentifier + EndpointIdentifier string `json:"EndpointIdentifier,omitempty"` + + // EndpointType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-endpointtype + EndpointType string `json:"EndpointType,omitempty"` + + // EngineName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-enginename + EngineName string `json:"EngineName,omitempty"` + + // ExtraConnectionAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-extraconnectionattributes + ExtraConnectionAttributes string `json:"ExtraConnectionAttributes,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // MongoDbSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-mongodbsettings + MongoDbSettings *AWSDMSEndpoint_MongoDbSettings `json:"MongoDbSettings,omitempty"` + + // Password AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-password + Password string `json:"Password,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-port + Port int `json:"Port,omitempty"` + + // S3Settings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-s3settings + S3Settings *AWSDMSEndpoint_S3Settings `json:"S3Settings,omitempty"` + + // ServerName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-servername + ServerName string `json:"ServerName,omitempty"` + + // SslMode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-sslmode + SslMode string `json:"SslMode,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-tags + Tags []Tag `json:"Tags,omitempty"` + + // Username AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-username + Username string `json:"Username,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEndpoint) AWSCloudFormationType() string { + return "AWS::DMS::Endpoint" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSEndpoint) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDMSEndpoint) MarshalJSON() ([]byte, error) { + type Properties AWSDMSEndpoint + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDMSEndpoint) UnmarshalJSON(b []byte) error { + type Properties AWSDMSEndpoint + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDMSEndpoint(*res.Properties) + } + + return nil +} + +// GetAllAWSDMSEndpointResources retrieves all AWSDMSEndpoint items from an AWS CloudFormation template +func (t *Template) GetAllAWSDMSEndpointResources() map[string]AWSDMSEndpoint { + results := map[string]AWSDMSEndpoint{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDMSEndpoint: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::Endpoint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSEndpoint + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDMSEndpointWithName retrieves all AWSDMSEndpoint items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDMSEndpointWithName(name string) (AWSDMSEndpoint, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDMSEndpoint: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::Endpoint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSEndpoint + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDMSEndpoint{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_dynamodbsettings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_dynamodbsettings.go new file mode 100644 index 0000000000..b9c3f4ec11 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_dynamodbsettings.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSDMSEndpoint_DynamoDbSettings AWS CloudFormation Resource (AWS::DMS::Endpoint.DynamoDbSettings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-dynamodbsettings.html +type AWSDMSEndpoint_DynamoDbSettings struct { + + // ServiceAccessRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-dynamodbsettings.html#cfn-dms-endpoint-dynamodbsettings-serviceaccessrolearn + ServiceAccessRoleArn string `json:"ServiceAccessRoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEndpoint_DynamoDbSettings) AWSCloudFormationType() string { + return "AWS::DMS::Endpoint.DynamoDbSettings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSEndpoint_DynamoDbSettings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_mongodbsettings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_mongodbsettings.go new file mode 100644 index 0000000000..243b3f6675 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_mongodbsettings.go @@ -0,0 +1,71 @@ +package cloudformation + +// AWSDMSEndpoint_MongoDbSettings AWS CloudFormation Resource (AWS::DMS::Endpoint.MongoDbSettings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html +type AWSDMSEndpoint_MongoDbSettings struct { + + // AuthMechanism AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-authmechanism + AuthMechanism string `json:"AuthMechanism,omitempty"` + + // AuthSource AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-authsource + AuthSource string `json:"AuthSource,omitempty"` + + // AuthType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-authtype + AuthType string `json:"AuthType,omitempty"` + + // DatabaseName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-databasename + DatabaseName string `json:"DatabaseName,omitempty"` + + // DocsToInvestigate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-docstoinvestigate + DocsToInvestigate string `json:"DocsToInvestigate,omitempty"` + + // ExtractDocId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-extractdocid + ExtractDocId string `json:"ExtractDocId,omitempty"` + + // NestingLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-nestinglevel + NestingLevel string `json:"NestingLevel,omitempty"` + + // Password AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-password + Password string `json:"Password,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-port + Port int `json:"Port,omitempty"` + + // ServerName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-servername + ServerName string `json:"ServerName,omitempty"` + + // Username AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-mongodbsettings.html#cfn-dms-endpoint-mongodbsettings-username + Username string `json:"Username,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEndpoint_MongoDbSettings) AWSCloudFormationType() string { + return "AWS::DMS::Endpoint.MongoDbSettings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSEndpoint_MongoDbSettings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_s3settings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_s3settings.go new file mode 100644 index 0000000000..28560b6946 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_s3settings.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSDMSEndpoint_S3Settings AWS CloudFormation Resource (AWS::DMS::Endpoint.S3Settings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-s3settings.html +type AWSDMSEndpoint_S3Settings struct { + + // BucketFolder AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-s3settings.html#cfn-dms-endpoint-s3settings-bucketfolder + BucketFolder string `json:"BucketFolder,omitempty"` + + // BucketName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-s3settings.html#cfn-dms-endpoint-s3settings-bucketname + BucketName string `json:"BucketName,omitempty"` + + // CompressionType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-s3settings.html#cfn-dms-endpoint-s3settings-compressiontype + CompressionType string `json:"CompressionType,omitempty"` + + // CsvDelimiter AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-s3settings.html#cfn-dms-endpoint-s3settings-csvdelimiter + CsvDelimiter string `json:"CsvDelimiter,omitempty"` + + // CsvRowDelimiter AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-s3settings.html#cfn-dms-endpoint-s3settings-csvrowdelimiter + CsvRowDelimiter string `json:"CsvRowDelimiter,omitempty"` + + // ExternalTableDefinition AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-s3settings.html#cfn-dms-endpoint-s3settings-externaltabledefinition + ExternalTableDefinition string `json:"ExternalTableDefinition,omitempty"` + + // ServiceAccessRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-s3settings.html#cfn-dms-endpoint-s3settings-serviceaccessrolearn + ServiceAccessRoleArn string `json:"ServiceAccessRoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEndpoint_S3Settings) AWSCloudFormationType() string { + return "AWS::DMS::Endpoint.S3Settings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSEndpoint_S3Settings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-eventsubscription.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-eventsubscription.go new file mode 100644 index 0000000000..3b56a8300c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-eventsubscription.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDMSEventSubscription AWS CloudFormation Resource (AWS::DMS::EventSubscription) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html +type AWSDMSEventSubscription struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html#cfn-dms-eventsubscription-enabled + Enabled bool `json:"Enabled,omitempty"` + + // EventCategories AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html#cfn-dms-eventsubscription-eventcategories + EventCategories []string `json:"EventCategories,omitempty"` + + // SnsTopicArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html#cfn-dms-eventsubscription-snstopicarn + SnsTopicArn string `json:"SnsTopicArn,omitempty"` + + // SourceIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html#cfn-dms-eventsubscription-sourceids + SourceIds []string `json:"SourceIds,omitempty"` + + // SourceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html#cfn-dms-eventsubscription-sourcetype + SourceType string `json:"SourceType,omitempty"` + + // SubscriptionName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html#cfn-dms-eventsubscription-subscriptionname + SubscriptionName string `json:"SubscriptionName,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html#cfn-dms-eventsubscription-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEventSubscription) AWSCloudFormationType() string { + return "AWS::DMS::EventSubscription" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSEventSubscription) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDMSEventSubscription) MarshalJSON() ([]byte, error) { + type Properties AWSDMSEventSubscription + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDMSEventSubscription) UnmarshalJSON(b []byte) error { + type Properties AWSDMSEventSubscription + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDMSEventSubscription(*res.Properties) + } + + return nil +} + +// GetAllAWSDMSEventSubscriptionResources retrieves all AWSDMSEventSubscription items from an AWS CloudFormation template +func (t *Template) GetAllAWSDMSEventSubscriptionResources() map[string]AWSDMSEventSubscription { + results := map[string]AWSDMSEventSubscription{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDMSEventSubscription: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::EventSubscription" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSEventSubscription + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDMSEventSubscriptionWithName retrieves all AWSDMSEventSubscription items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDMSEventSubscriptionWithName(name string) (AWSDMSEventSubscription, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDMSEventSubscription: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::EventSubscription" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSEventSubscription + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDMSEventSubscription{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationinstance.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationinstance.go new file mode 100644 index 0000000000..5cf77d4522 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationinstance.go @@ -0,0 +1,180 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDMSReplicationInstance AWS CloudFormation Resource (AWS::DMS::ReplicationInstance) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html +type AWSDMSReplicationInstance struct { + + // AllocatedStorage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-allocatedstorage + AllocatedStorage int `json:"AllocatedStorage,omitempty"` + + // AllowMajorVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-allowmajorversionupgrade + AllowMajorVersionUpgrade bool `json:"AllowMajorVersionUpgrade,omitempty"` + + // AutoMinorVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-autominorversionupgrade + AutoMinorVersionUpgrade bool `json:"AutoMinorVersionUpgrade,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // EngineVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-engineversion + EngineVersion string `json:"EngineVersion,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // MultiAZ AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-multiaz + MultiAZ bool `json:"MultiAZ,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // PubliclyAccessible AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-publiclyaccessible + PubliclyAccessible bool `json:"PubliclyAccessible,omitempty"` + + // ReplicationInstanceClass AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-replicationinstanceclass + ReplicationInstanceClass string `json:"ReplicationInstanceClass,omitempty"` + + // ReplicationInstanceIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-replicationinstanceidentifier + ReplicationInstanceIdentifier string `json:"ReplicationInstanceIdentifier,omitempty"` + + // ReplicationSubnetGroupIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-replicationsubnetgroupidentifier + ReplicationSubnetGroupIdentifier string `json:"ReplicationSubnetGroupIdentifier,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcSecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-vpcsecuritygroupids + VpcSecurityGroupIds []string `json:"VpcSecurityGroupIds,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSReplicationInstance) AWSCloudFormationType() string { + return "AWS::DMS::ReplicationInstance" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSReplicationInstance) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDMSReplicationInstance) MarshalJSON() ([]byte, error) { + type Properties AWSDMSReplicationInstance + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDMSReplicationInstance) UnmarshalJSON(b []byte) error { + type Properties AWSDMSReplicationInstance + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDMSReplicationInstance(*res.Properties) + } + + return nil +} + +// GetAllAWSDMSReplicationInstanceResources retrieves all AWSDMSReplicationInstance items from an AWS CloudFormation template +func (t *Template) GetAllAWSDMSReplicationInstanceResources() map[string]AWSDMSReplicationInstance { + results := map[string]AWSDMSReplicationInstance{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDMSReplicationInstance: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::ReplicationInstance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSReplicationInstance + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDMSReplicationInstanceWithName retrieves all AWSDMSReplicationInstance items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDMSReplicationInstanceWithName(name string) (AWSDMSReplicationInstance, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDMSReplicationInstance: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::ReplicationInstance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSReplicationInstance + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDMSReplicationInstance{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationsubnetgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationsubnetgroup.go new file mode 100644 index 0000000000..e83fffc6b5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationsubnetgroup.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDMSReplicationSubnetGroup AWS CloudFormation Resource (AWS::DMS::ReplicationSubnetGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html +type AWSDMSReplicationSubnetGroup struct { + + // ReplicationSubnetGroupDescription AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html#cfn-dms-replicationsubnetgroup-replicationsubnetgroupdescription + ReplicationSubnetGroupDescription string `json:"ReplicationSubnetGroupDescription,omitempty"` + + // ReplicationSubnetGroupIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html#cfn-dms-replicationsubnetgroup-replicationsubnetgroupidentifier + ReplicationSubnetGroupIdentifier string `json:"ReplicationSubnetGroupIdentifier,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html#cfn-dms-replicationsubnetgroup-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html#cfn-dms-replicationsubnetgroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSReplicationSubnetGroup) AWSCloudFormationType() string { + return "AWS::DMS::ReplicationSubnetGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSReplicationSubnetGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDMSReplicationSubnetGroup) MarshalJSON() ([]byte, error) { + type Properties AWSDMSReplicationSubnetGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDMSReplicationSubnetGroup) UnmarshalJSON(b []byte) error { + type Properties AWSDMSReplicationSubnetGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDMSReplicationSubnetGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSDMSReplicationSubnetGroupResources retrieves all AWSDMSReplicationSubnetGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSDMSReplicationSubnetGroupResources() map[string]AWSDMSReplicationSubnetGroup { + results := map[string]AWSDMSReplicationSubnetGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDMSReplicationSubnetGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::ReplicationSubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSReplicationSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDMSReplicationSubnetGroupWithName retrieves all AWSDMSReplicationSubnetGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDMSReplicationSubnetGroupWithName(name string) (AWSDMSReplicationSubnetGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDMSReplicationSubnetGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::ReplicationSubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSReplicationSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDMSReplicationSubnetGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationtask.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationtask.go new file mode 100644 index 0000000000..7fe6f0d5e0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationtask.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDMSReplicationTask AWS CloudFormation Resource (AWS::DMS::ReplicationTask) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html +type AWSDMSReplicationTask struct { + + // CdcStartTime AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-cdcstarttime + CdcStartTime float64 `json:"CdcStartTime,omitempty"` + + // MigrationType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-migrationtype + MigrationType string `json:"MigrationType,omitempty"` + + // ReplicationInstanceArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-replicationinstancearn + ReplicationInstanceArn string `json:"ReplicationInstanceArn,omitempty"` + + // ReplicationTaskIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-replicationtaskidentifier + ReplicationTaskIdentifier string `json:"ReplicationTaskIdentifier,omitempty"` + + // ReplicationTaskSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-replicationtasksettings + ReplicationTaskSettings string `json:"ReplicationTaskSettings,omitempty"` + + // SourceEndpointArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-sourceendpointarn + SourceEndpointArn string `json:"SourceEndpointArn,omitempty"` + + // TableMappings AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-tablemappings + TableMappings string `json:"TableMappings,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-tags + Tags []Tag `json:"Tags,omitempty"` + + // TargetEndpointArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-targetendpointarn + TargetEndpointArn string `json:"TargetEndpointArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSReplicationTask) AWSCloudFormationType() string { + return "AWS::DMS::ReplicationTask" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDMSReplicationTask) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDMSReplicationTask) MarshalJSON() ([]byte, error) { + type Properties AWSDMSReplicationTask + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDMSReplicationTask) UnmarshalJSON(b []byte) error { + type Properties AWSDMSReplicationTask + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDMSReplicationTask(*res.Properties) + } + + return nil +} + +// GetAllAWSDMSReplicationTaskResources retrieves all AWSDMSReplicationTask items from an AWS CloudFormation template +func (t *Template) GetAllAWSDMSReplicationTaskResources() map[string]AWSDMSReplicationTask { + results := map[string]AWSDMSReplicationTask{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDMSReplicationTask: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::ReplicationTask" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSReplicationTask + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDMSReplicationTaskWithName retrieves all AWSDMSReplicationTask items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDMSReplicationTaskWithName(name string) (AWSDMSReplicationTask, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDMSReplicationTask: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DMS::ReplicationTask" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDMSReplicationTask + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDMSReplicationTask{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table.go new file mode 100644 index 0000000000..dedfeb8520 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDynamoDBTable AWS CloudFormation Resource (AWS::DynamoDB::Table) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html +type AWSDynamoDBTable struct { + + // AttributeDefinitions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-attributedef + AttributeDefinitions []AWSDynamoDBTable_AttributeDefinition `json:"AttributeDefinitions,omitempty"` + + // GlobalSecondaryIndexes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-gsi + GlobalSecondaryIndexes []AWSDynamoDBTable_GlobalSecondaryIndex `json:"GlobalSecondaryIndexes,omitempty"` + + // KeySchema AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-keyschema + KeySchema []AWSDynamoDBTable_KeySchema `json:"KeySchema,omitempty"` + + // LocalSecondaryIndexes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-lsi + LocalSecondaryIndexes []AWSDynamoDBTable_LocalSecondaryIndex `json:"LocalSecondaryIndexes,omitempty"` + + // ProvisionedThroughput AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-provisionedthroughput + ProvisionedThroughput *AWSDynamoDBTable_ProvisionedThroughput `json:"ProvisionedThroughput,omitempty"` + + // StreamSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-streamspecification + StreamSpecification *AWSDynamoDBTable_StreamSpecification `json:"StreamSpecification,omitempty"` + + // TableName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-tablename + TableName string `json:"TableName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDynamoDBTable) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSDynamoDBTable) MarshalJSON() ([]byte, error) { + type Properties AWSDynamoDBTable + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDynamoDBTable) UnmarshalJSON(b []byte) error { + type Properties AWSDynamoDBTable + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSDynamoDBTable(*res.Properties) + } + + return nil +} + +// GetAllAWSDynamoDBTableResources retrieves all AWSDynamoDBTable items from an AWS CloudFormation template +func (t *Template) GetAllAWSDynamoDBTableResources() map[string]AWSDynamoDBTable { + results := map[string]AWSDynamoDBTable{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDynamoDBTable: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DynamoDB::Table" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDynamoDBTable + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDynamoDBTableWithName retrieves all AWSDynamoDBTable items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDynamoDBTableWithName(name string) (AWSDynamoDBTable, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDynamoDBTable: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::DynamoDB::Table" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDynamoDBTable + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDynamoDBTable{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_attributedefinition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_attributedefinition.go new file mode 100644 index 0000000000..ca76ecf79b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_attributedefinition.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDynamoDBTable_AttributeDefinition AWS CloudFormation Resource (AWS::DynamoDB::Table.AttributeDefinition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-attributedef.html +type AWSDynamoDBTable_AttributeDefinition struct { + + // AttributeName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-attributedef.html#cfn-dynamodb-attributedef-attributename + AttributeName string `json:"AttributeName,omitempty"` + + // AttributeType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-attributedef.html#cfn-dynamodb-attributedef-attributename-attributetype + AttributeType string `json:"AttributeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_AttributeDefinition) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.AttributeDefinition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDynamoDBTable_AttributeDefinition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_globalsecondaryindex.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_globalsecondaryindex.go new file mode 100644 index 0000000000..ce8a167ce3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_globalsecondaryindex.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSDynamoDBTable_GlobalSecondaryIndex AWS CloudFormation Resource (AWS::DynamoDB::Table.GlobalSecondaryIndex) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-gsi.html +type AWSDynamoDBTable_GlobalSecondaryIndex struct { + + // IndexName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-gsi.html#cfn-dynamodb-gsi-indexname + IndexName string `json:"IndexName,omitempty"` + + // KeySchema AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-gsi.html#cfn-dynamodb-gsi-keyschema + KeySchema []AWSDynamoDBTable_KeySchema `json:"KeySchema,omitempty"` + + // Projection AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-gsi.html#cfn-dynamodb-gsi-projection + Projection *AWSDynamoDBTable_Projection `json:"Projection,omitempty"` + + // ProvisionedThroughput AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-gsi.html#cfn-dynamodb-gsi-provisionedthroughput + ProvisionedThroughput *AWSDynamoDBTable_ProvisionedThroughput `json:"ProvisionedThroughput,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_GlobalSecondaryIndex) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.GlobalSecondaryIndex" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDynamoDBTable_GlobalSecondaryIndex) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_keyschema.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_keyschema.go new file mode 100644 index 0000000000..8e9b68bed9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_keyschema.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDynamoDBTable_KeySchema AWS CloudFormation Resource (AWS::DynamoDB::Table.KeySchema) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-keyschema.html +type AWSDynamoDBTable_KeySchema struct { + + // AttributeName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-keyschema.html#aws-properties-dynamodb-keyschema-attributename + AttributeName string `json:"AttributeName,omitempty"` + + // KeyType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-keyschema.html#aws-properties-dynamodb-keyschema-keytype + KeyType string `json:"KeyType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_KeySchema) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.KeySchema" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDynamoDBTable_KeySchema) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_localsecondaryindex.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_localsecondaryindex.go new file mode 100644 index 0000000000..63dc3e7441 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_localsecondaryindex.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSDynamoDBTable_LocalSecondaryIndex AWS CloudFormation Resource (AWS::DynamoDB::Table.LocalSecondaryIndex) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-lsi.html +type AWSDynamoDBTable_LocalSecondaryIndex struct { + + // IndexName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-lsi.html#cfn-dynamodb-lsi-indexname + IndexName string `json:"IndexName,omitempty"` + + // KeySchema AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-lsi.html#cfn-dynamodb-lsi-keyschema + KeySchema []AWSDynamoDBTable_KeySchema `json:"KeySchema,omitempty"` + + // Projection AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-lsi.html#cfn-dynamodb-lsi-projection + Projection *AWSDynamoDBTable_Projection `json:"Projection,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_LocalSecondaryIndex) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.LocalSecondaryIndex" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDynamoDBTable_LocalSecondaryIndex) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_projection.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_projection.go new file mode 100644 index 0000000000..caa9e9cc4e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_projection.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDynamoDBTable_Projection AWS CloudFormation Resource (AWS::DynamoDB::Table.Projection) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-projectionobject.html +type AWSDynamoDBTable_Projection struct { + + // NonKeyAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-projectionobject.html#cfn-dynamodb-projectionobj-nonkeyatt + NonKeyAttributes []string `json:"NonKeyAttributes,omitempty"` + + // ProjectionType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-projectionobject.html#cfn-dynamodb-projectionobj-projtype + ProjectionType string `json:"ProjectionType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_Projection) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.Projection" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDynamoDBTable_Projection) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_provisionedthroughput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_provisionedthroughput.go new file mode 100644 index 0000000000..6c5fb41d80 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_provisionedthroughput.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSDynamoDBTable_ProvisionedThroughput AWS CloudFormation Resource (AWS::DynamoDB::Table.ProvisionedThroughput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html +type AWSDynamoDBTable_ProvisionedThroughput struct { + + // ReadCapacityUnits AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html#cfn-dynamodb-provisionedthroughput-readcapacityunits + ReadCapacityUnits int `json:"ReadCapacityUnits,omitempty"` + + // WriteCapacityUnits AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html#cfn-dynamodb-provisionedthroughput-writecapacityunits + WriteCapacityUnits int `json:"WriteCapacityUnits,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_ProvisionedThroughput) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.ProvisionedThroughput" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDynamoDBTable_ProvisionedThroughput) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_streamspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_streamspecification.go new file mode 100644 index 0000000000..8be2f8c00f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_streamspecification.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSDynamoDBTable_StreamSpecification AWS CloudFormation Resource (AWS::DynamoDB::Table.StreamSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-streamspecification.html +type AWSDynamoDBTable_StreamSpecification struct { + + // StreamViewType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-streamspecification.html#cfn-dynamodb-streamspecification-streamviewtype + StreamViewType string `json:"StreamViewType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_StreamSpecification) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.StreamSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSDynamoDBTable_StreamSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-customergateway.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-customergateway.go new file mode 100644 index 0000000000..42c004f50e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-customergateway.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2CustomerGateway AWS CloudFormation Resource (AWS::EC2::CustomerGateway) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html +type AWSEC2CustomerGateway struct { + + // BgpAsn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-bgpasn + BgpAsn int `json:"BgpAsn,omitempty"` + + // IpAddress AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-ipaddress + IpAddress string `json:"IpAddress,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-tags + Tags []Tag `json:"Tags,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2CustomerGateway) AWSCloudFormationType() string { + return "AWS::EC2::CustomerGateway" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2CustomerGateway) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2CustomerGateway) MarshalJSON() ([]byte, error) { + type Properties AWSEC2CustomerGateway + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2CustomerGateway) UnmarshalJSON(b []byte) error { + type Properties AWSEC2CustomerGateway + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2CustomerGateway(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2CustomerGatewayResources retrieves all AWSEC2CustomerGateway items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2CustomerGatewayResources() map[string]AWSEC2CustomerGateway { + results := map[string]AWSEC2CustomerGateway{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2CustomerGateway: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::CustomerGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2CustomerGateway + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2CustomerGatewayWithName retrieves all AWSEC2CustomerGateway items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2CustomerGatewayWithName(name string) (AWSEC2CustomerGateway, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2CustomerGateway: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::CustomerGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2CustomerGateway + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2CustomerGateway{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-dhcpoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-dhcpoptions.go new file mode 100644 index 0000000000..1b292b1d28 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-dhcpoptions.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2DHCPOptions AWS CloudFormation Resource (AWS::EC2::DHCPOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html +type AWSEC2DHCPOptions struct { + + // DomainName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-domainname + DomainName string `json:"DomainName,omitempty"` + + // DomainNameServers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-domainnameservers + DomainNameServers []string `json:"DomainNameServers,omitempty"` + + // NetbiosNameServers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-netbiosnameservers + NetbiosNameServers []string `json:"NetbiosNameServers,omitempty"` + + // NetbiosNodeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-netbiosnodetype + NetbiosNodeType int `json:"NetbiosNodeType,omitempty"` + + // NtpServers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-ntpservers + NtpServers []string `json:"NtpServers,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2DHCPOptions) AWSCloudFormationType() string { + return "AWS::EC2::DHCPOptions" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2DHCPOptions) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2DHCPOptions) MarshalJSON() ([]byte, error) { + type Properties AWSEC2DHCPOptions + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2DHCPOptions) UnmarshalJSON(b []byte) error { + type Properties AWSEC2DHCPOptions + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2DHCPOptions(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2DHCPOptionsResources retrieves all AWSEC2DHCPOptions items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2DHCPOptionsResources() map[string]AWSEC2DHCPOptions { + results := map[string]AWSEC2DHCPOptions{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2DHCPOptions: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::DHCPOptions" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2DHCPOptions + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2DHCPOptionsWithName retrieves all AWSEC2DHCPOptions items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2DHCPOptionsWithName(name string) (AWSEC2DHCPOptions, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2DHCPOptions: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::DHCPOptions" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2DHCPOptions + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2DHCPOptions{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-egressonlyinternetgateway.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-egressonlyinternetgateway.go new file mode 100644 index 0000000000..3d1519c6f1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-egressonlyinternetgateway.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2EgressOnlyInternetGateway AWS CloudFormation Resource (AWS::EC2::EgressOnlyInternetGateway) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-egressonlyinternetgateway.html +type AWSEC2EgressOnlyInternetGateway struct { + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-egressonlyinternetgateway.html#cfn-ec2-egressonlyinternetgateway-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2EgressOnlyInternetGateway) AWSCloudFormationType() string { + return "AWS::EC2::EgressOnlyInternetGateway" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2EgressOnlyInternetGateway) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2EgressOnlyInternetGateway) MarshalJSON() ([]byte, error) { + type Properties AWSEC2EgressOnlyInternetGateway + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2EgressOnlyInternetGateway) UnmarshalJSON(b []byte) error { + type Properties AWSEC2EgressOnlyInternetGateway + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2EgressOnlyInternetGateway(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2EgressOnlyInternetGatewayResources retrieves all AWSEC2EgressOnlyInternetGateway items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2EgressOnlyInternetGatewayResources() map[string]AWSEC2EgressOnlyInternetGateway { + results := map[string]AWSEC2EgressOnlyInternetGateway{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2EgressOnlyInternetGateway: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::EgressOnlyInternetGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2EgressOnlyInternetGateway + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2EgressOnlyInternetGatewayWithName retrieves all AWSEC2EgressOnlyInternetGateway items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2EgressOnlyInternetGatewayWithName(name string) (AWSEC2EgressOnlyInternetGateway, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2EgressOnlyInternetGateway: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::EgressOnlyInternetGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2EgressOnlyInternetGateway + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2EgressOnlyInternetGateway{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-eip.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-eip.go new file mode 100644 index 0000000000..1d5315274d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-eip.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2EIP AWS CloudFormation Resource (AWS::EC2::EIP) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html +type AWSEC2EIP struct { + + // Domain AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-domain + Domain string `json:"Domain,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-instanceid + InstanceId string `json:"InstanceId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2EIP) AWSCloudFormationType() string { + return "AWS::EC2::EIP" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2EIP) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2EIP) MarshalJSON() ([]byte, error) { + type Properties AWSEC2EIP + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2EIP) UnmarshalJSON(b []byte) error { + type Properties AWSEC2EIP + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2EIP(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2EIPResources retrieves all AWSEC2EIP items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2EIPResources() map[string]AWSEC2EIP { + results := map[string]AWSEC2EIP{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2EIP: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::EIP" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2EIP + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2EIPWithName retrieves all AWSEC2EIP items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2EIPWithName(name string) (AWSEC2EIP, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2EIP: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::EIP" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2EIP + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2EIP{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-eipassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-eipassociation.go new file mode 100644 index 0000000000..58bfc488ef --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-eipassociation.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2EIPAssociation AWS CloudFormation Resource (AWS::EC2::EIPAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html +type AWSEC2EIPAssociation struct { + + // AllocationId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-allocationid + AllocationId string `json:"AllocationId,omitempty"` + + // EIP AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-eip + EIP string `json:"EIP,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-instanceid + InstanceId string `json:"InstanceId,omitempty"` + + // NetworkInterfaceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-networkinterfaceid + NetworkInterfaceId string `json:"NetworkInterfaceId,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-PrivateIpAddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2EIPAssociation) AWSCloudFormationType() string { + return "AWS::EC2::EIPAssociation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2EIPAssociation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2EIPAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSEC2EIPAssociation + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2EIPAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSEC2EIPAssociation + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2EIPAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2EIPAssociationResources retrieves all AWSEC2EIPAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2EIPAssociationResources() map[string]AWSEC2EIPAssociation { + results := map[string]AWSEC2EIPAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2EIPAssociation: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::EIPAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2EIPAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2EIPAssociationWithName retrieves all AWSEC2EIPAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2EIPAssociationWithName(name string) (AWSEC2EIPAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2EIPAssociation: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::EIPAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2EIPAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2EIPAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-flowlog.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-flowlog.go new file mode 100644 index 0000000000..6efd100b01 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-flowlog.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2FlowLog AWS CloudFormation Resource (AWS::EC2::FlowLog) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html +type AWSEC2FlowLog struct { + + // DeliverLogsPermissionArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-deliverlogspermissionarn + DeliverLogsPermissionArn string `json:"DeliverLogsPermissionArn,omitempty"` + + // LogGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-loggroupname + LogGroupName string `json:"LogGroupName,omitempty"` + + // ResourceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-resourceid + ResourceId string `json:"ResourceId,omitempty"` + + // ResourceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-resourcetype + ResourceType string `json:"ResourceType,omitempty"` + + // TrafficType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-traffictype + TrafficType string `json:"TrafficType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2FlowLog) AWSCloudFormationType() string { + return "AWS::EC2::FlowLog" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2FlowLog) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2FlowLog) MarshalJSON() ([]byte, error) { + type Properties AWSEC2FlowLog + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2FlowLog) UnmarshalJSON(b []byte) error { + type Properties AWSEC2FlowLog + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2FlowLog(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2FlowLogResources retrieves all AWSEC2FlowLog items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2FlowLogResources() map[string]AWSEC2FlowLog { + results := map[string]AWSEC2FlowLog{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2FlowLog: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::FlowLog" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2FlowLog + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2FlowLogWithName retrieves all AWSEC2FlowLog items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2FlowLogWithName(name string) (AWSEC2FlowLog, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2FlowLog: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::FlowLog" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2FlowLog + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2FlowLog{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-host.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-host.go new file mode 100644 index 0000000000..f307574ea1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-host.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2Host AWS CloudFormation Resource (AWS::EC2::Host) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html +type AWSEC2Host struct { + + // AutoPlacement AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-autoplacement + AutoPlacement string `json:"AutoPlacement,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-instancetype + InstanceType string `json:"InstanceType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Host) AWSCloudFormationType() string { + return "AWS::EC2::Host" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Host) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2Host) MarshalJSON() ([]byte, error) { + type Properties AWSEC2Host + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2Host) UnmarshalJSON(b []byte) error { + type Properties AWSEC2Host + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2Host(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2HostResources retrieves all AWSEC2Host items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2HostResources() map[string]AWSEC2Host { + results := map[string]AWSEC2Host{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2Host: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Host" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Host + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2HostWithName retrieves all AWSEC2Host items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2HostWithName(name string) (AWSEC2Host, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2Host: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Host" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Host + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2Host{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance.go new file mode 100644 index 0000000000..a3e492f9f4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance.go @@ -0,0 +1,255 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2Instance AWS CloudFormation Resource (AWS::EC2::Instance) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html +type AWSEC2Instance struct { + + // AdditionalInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-additionalinfo + AdditionalInfo string `json:"AdditionalInfo,omitempty"` + + // Affinity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-affinity + Affinity string `json:"Affinity,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // BlockDeviceMappings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-blockdevicemappings + BlockDeviceMappings []AWSEC2Instance_BlockDeviceMapping `json:"BlockDeviceMappings,omitempty"` + + // DisableApiTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-disableapitermination + DisableApiTermination bool `json:"DisableApiTermination,omitempty"` + + // EbsOptimized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` + + // HostId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hostid + HostId string `json:"HostId,omitempty"` + + // IamInstanceProfile AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-iaminstanceprofile + IamInstanceProfile string `json:"IamInstanceProfile,omitempty"` + + // ImageId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-imageid + ImageId string `json:"ImageId,omitempty"` + + // InstanceInitiatedShutdownBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-instanceinitiatedshutdownbehavior + InstanceInitiatedShutdownBehavior string `json:"InstanceInitiatedShutdownBehavior,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // Ipv6AddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ipv6addresscount + Ipv6AddressCount int `json:"Ipv6AddressCount,omitempty"` + + // Ipv6Addresses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ipv6addresses + Ipv6Addresses []AWSEC2Instance_InstanceIpv6Address `json:"Ipv6Addresses,omitempty"` + + // KernelId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-kernelid + KernelId string `json:"KernelId,omitempty"` + + // KeyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-keyname + KeyName string `json:"KeyName,omitempty"` + + // Monitoring AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-monitoring + Monitoring bool `json:"Monitoring,omitempty"` + + // NetworkInterfaces AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-networkinterfaces + NetworkInterfaces []AWSEC2Instance_NetworkInterface `json:"NetworkInterfaces,omitempty"` + + // PlacementGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-placementgroupname + PlacementGroupName string `json:"PlacementGroupName,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-privateipaddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` + + // RamdiskId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ramdiskid + RamdiskId string `json:"RamdiskId,omitempty"` + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-securitygroups + SecurityGroups []string `json:"SecurityGroups,omitempty"` + + // SourceDestCheck AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-sourcedestcheck + SourceDestCheck bool `json:"SourceDestCheck,omitempty"` + + // SsmAssociations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ssmassociations + SsmAssociations []AWSEC2Instance_SsmAssociation `json:"SsmAssociations,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-tags + Tags []Tag `json:"Tags,omitempty"` + + // Tenancy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-tenancy + Tenancy string `json:"Tenancy,omitempty"` + + // UserData AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-userdata + UserData string `json:"UserData,omitempty"` + + // Volumes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-volumes + Volumes []AWSEC2Instance_Volume `json:"Volumes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance) AWSCloudFormationType() string { + return "AWS::EC2::Instance" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2Instance) MarshalJSON() ([]byte, error) { + type Properties AWSEC2Instance + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2Instance) UnmarshalJSON(b []byte) error { + type Properties AWSEC2Instance + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2Instance(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2InstanceResources retrieves all AWSEC2Instance items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2InstanceResources() map[string]AWSEC2Instance { + results := map[string]AWSEC2Instance{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2Instance: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Instance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Instance + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2InstanceWithName retrieves all AWSEC2Instance items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2InstanceWithName(name string) (AWSEC2Instance, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2Instance: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Instance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Instance + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2Instance{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_associationparameter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_associationparameter.go new file mode 100644 index 0000000000..9f5863cd27 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_associationparameter.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2Instance_AssociationParameter AWS CloudFormation Resource (AWS::EC2::Instance.AssociationParameter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html +type AWSEC2Instance_AssociationParameter struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html#cfn-ec2-instance-ssmassociations-associationparameters-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html#cfn-ec2-instance-ssmassociations-associationparameters-value + Value []string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_AssociationParameter) AWSCloudFormationType() string { + return "AWS::EC2::Instance.AssociationParameter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_AssociationParameter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_blockdevicemapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_blockdevicemapping.go new file mode 100644 index 0000000000..3276c4b0db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_blockdevicemapping.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSEC2Instance_BlockDeviceMapping AWS CloudFormation Resource (AWS::EC2::Instance.BlockDeviceMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html +type AWSEC2Instance_BlockDeviceMapping struct { + + // DeviceName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-devicename + DeviceName string `json:"DeviceName,omitempty"` + + // Ebs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-ebs + Ebs *AWSEC2Instance_Ebs `json:"Ebs,omitempty"` + + // NoDevice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-nodevice + NoDevice *AWSEC2Instance_NoDevice `json:"NoDevice,omitempty"` + + // VirtualName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-virtualname + VirtualName string `json:"VirtualName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::EC2::Instance.BlockDeviceMapping" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_BlockDeviceMapping) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_ebs.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_ebs.go new file mode 100644 index 0000000000..aedeef9bd5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_ebs.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSEC2Instance_Ebs AWS CloudFormation Resource (AWS::EC2::Instance.Ebs) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html +type AWSEC2Instance_Ebs struct { + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-deleteontermination + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // Encrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-encrypted + Encrypted bool `json:"Encrypted,omitempty"` + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-iops + Iops int `json:"Iops,omitempty"` + + // SnapshotId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-snapshotid + SnapshotId string `json:"SnapshotId,omitempty"` + + // VolumeSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-volumesize + VolumeSize int `json:"VolumeSize,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_Ebs) AWSCloudFormationType() string { + return "AWS::EC2::Instance.Ebs" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_Ebs) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_instanceipv6address.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_instanceipv6address.go new file mode 100644 index 0000000000..611c56e710 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_instanceipv6address.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEC2Instance_InstanceIpv6Address AWS CloudFormation Resource (AWS::EC2::Instance.InstanceIpv6Address) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-instanceipv6address.html +type AWSEC2Instance_InstanceIpv6Address struct { + + // Ipv6Address AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-instanceipv6address.html#cfn-ec2-instance-instanceipv6address-ipv6address + Ipv6Address string `json:"Ipv6Address,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_InstanceIpv6Address) AWSCloudFormationType() string { + return "AWS::EC2::Instance.InstanceIpv6Address" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_InstanceIpv6Address) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_networkinterface.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_networkinterface.go new file mode 100644 index 0000000000..44f6447156 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_networkinterface.go @@ -0,0 +1,76 @@ +package cloudformation + +// AWSEC2Instance_NetworkInterface AWS CloudFormation Resource (AWS::EC2::Instance.NetworkInterface) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html +type AWSEC2Instance_NetworkInterface struct { + + // AssociatePublicIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-associatepubip + AssociatePublicIpAddress bool `json:"AssociatePublicIpAddress,omitempty"` + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-delete + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-description + Description string `json:"Description,omitempty"` + + // DeviceIndex AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-deviceindex + DeviceIndex string `json:"DeviceIndex,omitempty"` + + // GroupSet AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-groupset + GroupSet []string `json:"GroupSet,omitempty"` + + // Ipv6AddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#cfn-ec2-instance-networkinterface-ipv6addresscount + Ipv6AddressCount int `json:"Ipv6AddressCount,omitempty"` + + // Ipv6Addresses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#cfn-ec2-instance-networkinterface-ipv6addresses + Ipv6Addresses []AWSEC2Instance_InstanceIpv6Address `json:"Ipv6Addresses,omitempty"` + + // NetworkInterfaceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-network-iface + NetworkInterfaceId string `json:"NetworkInterfaceId,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-privateipaddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` + + // PrivateIpAddresses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-privateipaddresses + PrivateIpAddresses []AWSEC2Instance_PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty"` + + // SecondaryPrivateIpAddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-secondprivateip + SecondaryPrivateIpAddressCount int `json:"SecondaryPrivateIpAddressCount,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-subnetid + SubnetId string `json:"SubnetId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_NetworkInterface) AWSCloudFormationType() string { + return "AWS::EC2::Instance.NetworkInterface" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_NetworkInterface) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_nodevice.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_nodevice.go new file mode 100644 index 0000000000..b3d046fc9e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_nodevice.go @@ -0,0 +1,16 @@ +package cloudformation + +// AWSEC2Instance_NoDevice AWS CloudFormation Resource (AWS::EC2::Instance.NoDevice) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-nodevice.html +type AWSEC2Instance_NoDevice struct { +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_NoDevice) AWSCloudFormationType() string { + return "AWS::EC2::Instance.NoDevice" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_NoDevice) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_privateipaddressspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_privateipaddressspecification.go new file mode 100644 index 0000000000..e6fc07dafc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_privateipaddressspecification.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2Instance_PrivateIpAddressSpecification AWS CloudFormation Resource (AWS::EC2::Instance.PrivateIpAddressSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html +type AWSEC2Instance_PrivateIpAddressSpecification struct { + + // Primary AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-primary + Primary bool `json:"Primary,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-privateipaddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_PrivateIpAddressSpecification) AWSCloudFormationType() string { + return "AWS::EC2::Instance.PrivateIpAddressSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_PrivateIpAddressSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_ssmassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_ssmassociation.go new file mode 100644 index 0000000000..c23b53705c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_ssmassociation.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2Instance_SsmAssociation AWS CloudFormation Resource (AWS::EC2::Instance.SsmAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html +type AWSEC2Instance_SsmAssociation struct { + + // AssociationParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html#cfn-ec2-instance-ssmassociations-associationparameters + AssociationParameters []AWSEC2Instance_AssociationParameter `json:"AssociationParameters,omitempty"` + + // DocumentName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html#cfn-ec2-instance-ssmassociations-documentname + DocumentName string `json:"DocumentName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_SsmAssociation) AWSCloudFormationType() string { + return "AWS::EC2::Instance.SsmAssociation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_SsmAssociation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_volume.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_volume.go new file mode 100644 index 0000000000..62e6427591 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_volume.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2Instance_Volume AWS CloudFormation Resource (AWS::EC2::Instance.Volume) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html +type AWSEC2Instance_Volume struct { + + // Device AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html#cfn-ec2-mountpoint-device + Device string `json:"Device,omitempty"` + + // VolumeId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html#cfn-ec2-mountpoint-volumeid + VolumeId string `json:"VolumeId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_Volume) AWSCloudFormationType() string { + return "AWS::EC2::Instance.Volume" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Instance_Volume) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-internetgateway.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-internetgateway.go new file mode 100644 index 0000000000..67270edf2b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-internetgateway.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2InternetGateway AWS CloudFormation Resource (AWS::EC2::InternetGateway) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html +type AWSEC2InternetGateway struct { + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html#cfn-ec2-internetgateway-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2InternetGateway) AWSCloudFormationType() string { + return "AWS::EC2::InternetGateway" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2InternetGateway) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2InternetGateway) MarshalJSON() ([]byte, error) { + type Properties AWSEC2InternetGateway + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2InternetGateway) UnmarshalJSON(b []byte) error { + type Properties AWSEC2InternetGateway + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2InternetGateway(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2InternetGatewayResources retrieves all AWSEC2InternetGateway items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2InternetGatewayResources() map[string]AWSEC2InternetGateway { + results := map[string]AWSEC2InternetGateway{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2InternetGateway: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::InternetGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2InternetGateway + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2InternetGatewayWithName retrieves all AWSEC2InternetGateway items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2InternetGatewayWithName(name string) (AWSEC2InternetGateway, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2InternetGateway: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::InternetGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2InternetGateway + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2InternetGateway{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-natgateway.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-natgateway.go new file mode 100644 index 0000000000..ef408652f0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-natgateway.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2NatGateway AWS CloudFormation Resource (AWS::EC2::NatGateway) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html +type AWSEC2NatGateway struct { + + // AllocationId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-allocationid + AllocationId string `json:"AllocationId,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-subnetid + SubnetId string `json:"SubnetId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NatGateway) AWSCloudFormationType() string { + return "AWS::EC2::NatGateway" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NatGateway) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2NatGateway) MarshalJSON() ([]byte, error) { + type Properties AWSEC2NatGateway + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2NatGateway) UnmarshalJSON(b []byte) error { + type Properties AWSEC2NatGateway + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2NatGateway(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2NatGatewayResources retrieves all AWSEC2NatGateway items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2NatGatewayResources() map[string]AWSEC2NatGateway { + results := map[string]AWSEC2NatGateway{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2NatGateway: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NatGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NatGateway + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2NatGatewayWithName retrieves all AWSEC2NatGateway items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2NatGatewayWithName(name string) (AWSEC2NatGateway, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2NatGateway: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NatGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NatGateway + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2NatGateway{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkacl.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkacl.go new file mode 100644 index 0000000000..9bac0455e3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkacl.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2NetworkAcl AWS CloudFormation Resource (AWS::EC2::NetworkAcl) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html +type AWSEC2NetworkAcl struct { + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html#cfn-ec2-networkacl-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html#cfn-ec2-networkacl-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkAcl) AWSCloudFormationType() string { + return "AWS::EC2::NetworkAcl" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkAcl) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2NetworkAcl) MarshalJSON() ([]byte, error) { + type Properties AWSEC2NetworkAcl + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2NetworkAcl) UnmarshalJSON(b []byte) error { + type Properties AWSEC2NetworkAcl + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2NetworkAcl(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2NetworkAclResources retrieves all AWSEC2NetworkAcl items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2NetworkAclResources() map[string]AWSEC2NetworkAcl { + results := map[string]AWSEC2NetworkAcl{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2NetworkAcl: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkAcl" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkAcl + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2NetworkAclWithName retrieves all AWSEC2NetworkAcl items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2NetworkAclWithName(name string) (AWSEC2NetworkAcl, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2NetworkAcl: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkAcl" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkAcl + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2NetworkAcl{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry.go new file mode 100644 index 0000000000..0aa06ff4ff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2NetworkAclEntry AWS CloudFormation Resource (AWS::EC2::NetworkAclEntry) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html +type AWSEC2NetworkAclEntry struct { + + // CidrBlock AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-cidrblock + CidrBlock string `json:"CidrBlock,omitempty"` + + // Egress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-egress + Egress bool `json:"Egress,omitempty"` + + // Icmp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-icmp + Icmp *AWSEC2NetworkAclEntry_Icmp `json:"Icmp,omitempty"` + + // Ipv6CidrBlock AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-ipv6cidrblock + Ipv6CidrBlock string `json:"Ipv6CidrBlock,omitempty"` + + // NetworkAclId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-networkaclid + NetworkAclId string `json:"NetworkAclId,omitempty"` + + // PortRange AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-portrange + PortRange *AWSEC2NetworkAclEntry_PortRange `json:"PortRange,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-protocol + Protocol int `json:"Protocol,omitempty"` + + // RuleAction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-ruleaction + RuleAction string `json:"RuleAction,omitempty"` + + // RuleNumber AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-rulenumber + RuleNumber int `json:"RuleNumber,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkAclEntry) AWSCloudFormationType() string { + return "AWS::EC2::NetworkAclEntry" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkAclEntry) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2NetworkAclEntry) MarshalJSON() ([]byte, error) { + type Properties AWSEC2NetworkAclEntry + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2NetworkAclEntry) UnmarshalJSON(b []byte) error { + type Properties AWSEC2NetworkAclEntry + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2NetworkAclEntry(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2NetworkAclEntryResources retrieves all AWSEC2NetworkAclEntry items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2NetworkAclEntryResources() map[string]AWSEC2NetworkAclEntry { + results := map[string]AWSEC2NetworkAclEntry{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2NetworkAclEntry: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkAclEntry" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkAclEntry + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2NetworkAclEntryWithName retrieves all AWSEC2NetworkAclEntry items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2NetworkAclEntryWithName(name string) (AWSEC2NetworkAclEntry, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2NetworkAclEntry: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkAclEntry" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkAclEntry + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2NetworkAclEntry{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry_icmp.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry_icmp.go new file mode 100644 index 0000000000..2271d656bc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry_icmp.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2NetworkAclEntry_Icmp AWS CloudFormation Resource (AWS::EC2::NetworkAclEntry.Icmp) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-icmp.html +type AWSEC2NetworkAclEntry_Icmp struct { + + // Code AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-icmp.html#cfn-ec2-networkaclentry-icmp-code + Code int `json:"Code,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-icmp.html#cfn-ec2-networkaclentry-icmp-type + Type int `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkAclEntry_Icmp) AWSCloudFormationType() string { + return "AWS::EC2::NetworkAclEntry.Icmp" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkAclEntry_Icmp) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry_portrange.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry_portrange.go new file mode 100644 index 0000000000..25cfc31620 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry_portrange.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2NetworkAclEntry_PortRange AWS CloudFormation Resource (AWS::EC2::NetworkAclEntry.PortRange) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-portrange.html +type AWSEC2NetworkAclEntry_PortRange struct { + + // From AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-portrange.html#cfn-ec2-networkaclentry-portrange-from + From int `json:"From,omitempty"` + + // To AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-portrange.html#cfn-ec2-networkaclentry-portrange-to + To int `json:"To,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkAclEntry_PortRange) AWSCloudFormationType() string { + return "AWS::EC2::NetworkAclEntry.PortRange" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkAclEntry_PortRange) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface.go new file mode 100644 index 0000000000..3e7ada6803 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface.go @@ -0,0 +1,165 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2NetworkInterface AWS CloudFormation Resource (AWS::EC2::NetworkInterface) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html +type AWSEC2NetworkInterface struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-description + Description string `json:"Description,omitempty"` + + // GroupSet AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-groupset + GroupSet []string `json:"GroupSet,omitempty"` + + // InterfaceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-interfacetype + InterfaceType string `json:"InterfaceType,omitempty"` + + // Ipv6AddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-ipv6addresscount + Ipv6AddressCount int `json:"Ipv6AddressCount,omitempty"` + + // Ipv6Addresses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-ipv6addresses + Ipv6Addresses *AWSEC2NetworkInterface_InstanceIpv6Address `json:"Ipv6Addresses,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-privateipaddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` + + // PrivateIpAddresses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-privateipaddresses + PrivateIpAddresses []AWSEC2NetworkInterface_PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty"` + + // SecondaryPrivateIpAddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-secondaryprivateipcount + SecondaryPrivateIpAddressCount int `json:"SecondaryPrivateIpAddressCount,omitempty"` + + // SourceDestCheck AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-sourcedestcheck + SourceDestCheck bool `json:"SourceDestCheck,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterface) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterface" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkInterface) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2NetworkInterface) MarshalJSON() ([]byte, error) { + type Properties AWSEC2NetworkInterface + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2NetworkInterface) UnmarshalJSON(b []byte) error { + type Properties AWSEC2NetworkInterface + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2NetworkInterface(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2NetworkInterfaceResources retrieves all AWSEC2NetworkInterface items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2NetworkInterfaceResources() map[string]AWSEC2NetworkInterface { + results := map[string]AWSEC2NetworkInterface{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2NetworkInterface: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkInterface" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkInterface + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2NetworkInterfaceWithName retrieves all AWSEC2NetworkInterface items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2NetworkInterfaceWithName(name string) (AWSEC2NetworkInterface, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2NetworkInterface: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkInterface" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkInterface + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2NetworkInterface{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface_instanceipv6address.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface_instanceipv6address.go new file mode 100644 index 0000000000..a9178da5da --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface_instanceipv6address.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEC2NetworkInterface_InstanceIpv6Address AWS CloudFormation Resource (AWS::EC2::NetworkInterface.InstanceIpv6Address) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinterface-instanceipv6address.html +type AWSEC2NetworkInterface_InstanceIpv6Address struct { + + // Ipv6Address AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinterface-instanceipv6address.html#cfn-ec2-networkinterface-instanceipv6address-ipv6address + Ipv6Address string `json:"Ipv6Address,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterface_InstanceIpv6Address) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterface.InstanceIpv6Address" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkInterface_InstanceIpv6Address) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface_privateipaddressspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface_privateipaddressspecification.go new file mode 100644 index 0000000000..e2a00de38c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface_privateipaddressspecification.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2NetworkInterface_PrivateIpAddressSpecification AWS CloudFormation Resource (AWS::EC2::NetworkInterface.PrivateIpAddressSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html +type AWSEC2NetworkInterface_PrivateIpAddressSpecification struct { + + // Primary AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-primary + Primary bool `json:"Primary,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-privateipaddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterface_PrivateIpAddressSpecification) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterface.PrivateIpAddressSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkInterface_PrivateIpAddressSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterfaceattachment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterfaceattachment.go new file mode 100644 index 0000000000..bab4647f8b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterfaceattachment.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2NetworkInterfaceAttachment AWS CloudFormation Resource (AWS::EC2::NetworkInterfaceAttachment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html +type AWSEC2NetworkInterfaceAttachment struct { + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-deleteonterm + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // DeviceIndex AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-deviceindex + DeviceIndex string `json:"DeviceIndex,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-instanceid + InstanceId string `json:"InstanceId,omitempty"` + + // NetworkInterfaceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-networkinterfaceid + NetworkInterfaceId string `json:"NetworkInterfaceId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterfaceAttachment) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterfaceAttachment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkInterfaceAttachment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2NetworkInterfaceAttachment) MarshalJSON() ([]byte, error) { + type Properties AWSEC2NetworkInterfaceAttachment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2NetworkInterfaceAttachment) UnmarshalJSON(b []byte) error { + type Properties AWSEC2NetworkInterfaceAttachment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2NetworkInterfaceAttachment(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2NetworkInterfaceAttachmentResources retrieves all AWSEC2NetworkInterfaceAttachment items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2NetworkInterfaceAttachmentResources() map[string]AWSEC2NetworkInterfaceAttachment { + results := map[string]AWSEC2NetworkInterfaceAttachment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2NetworkInterfaceAttachment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkInterfaceAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkInterfaceAttachment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2NetworkInterfaceAttachmentWithName retrieves all AWSEC2NetworkInterfaceAttachment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2NetworkInterfaceAttachmentWithName(name string) (AWSEC2NetworkInterfaceAttachment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2NetworkInterfaceAttachment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkInterfaceAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkInterfaceAttachment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2NetworkInterfaceAttachment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterfacepermission.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterfacepermission.go new file mode 100644 index 0000000000..1d6ea16d48 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterfacepermission.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2NetworkInterfacePermission AWS CloudFormation Resource (AWS::EC2::NetworkInterfacePermission) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html +type AWSEC2NetworkInterfacePermission struct { + + // AwsAccountId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-awsaccountid + AwsAccountId string `json:"AwsAccountId,omitempty"` + + // NetworkInterfaceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-networkinterfaceid + NetworkInterfaceId string `json:"NetworkInterfaceId,omitempty"` + + // Permission AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-permission + Permission string `json:"Permission,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterfacePermission) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterfacePermission" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2NetworkInterfacePermission) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2NetworkInterfacePermission) MarshalJSON() ([]byte, error) { + type Properties AWSEC2NetworkInterfacePermission + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2NetworkInterfacePermission) UnmarshalJSON(b []byte) error { + type Properties AWSEC2NetworkInterfacePermission + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2NetworkInterfacePermission(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2NetworkInterfacePermissionResources retrieves all AWSEC2NetworkInterfacePermission items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2NetworkInterfacePermissionResources() map[string]AWSEC2NetworkInterfacePermission { + results := map[string]AWSEC2NetworkInterfacePermission{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2NetworkInterfacePermission: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkInterfacePermission" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkInterfacePermission + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2NetworkInterfacePermissionWithName retrieves all AWSEC2NetworkInterfacePermission items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2NetworkInterfacePermissionWithName(name string) (AWSEC2NetworkInterfacePermission, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2NetworkInterfacePermission: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::NetworkInterfacePermission" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2NetworkInterfacePermission + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2NetworkInterfacePermission{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-placementgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-placementgroup.go new file mode 100644 index 0000000000..d8b3f9a3c7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-placementgroup.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2PlacementGroup AWS CloudFormation Resource (AWS::EC2::PlacementGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-placementgroup.html +type AWSEC2PlacementGroup struct { + + // Strategy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-placementgroup.html#cfn-ec2-placementgroup-strategy + Strategy string `json:"Strategy,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2PlacementGroup) AWSCloudFormationType() string { + return "AWS::EC2::PlacementGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2PlacementGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2PlacementGroup) MarshalJSON() ([]byte, error) { + type Properties AWSEC2PlacementGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2PlacementGroup) UnmarshalJSON(b []byte) error { + type Properties AWSEC2PlacementGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2PlacementGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2PlacementGroupResources retrieves all AWSEC2PlacementGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2PlacementGroupResources() map[string]AWSEC2PlacementGroup { + results := map[string]AWSEC2PlacementGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2PlacementGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::PlacementGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2PlacementGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2PlacementGroupWithName retrieves all AWSEC2PlacementGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2PlacementGroupWithName(name string) (AWSEC2PlacementGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2PlacementGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::PlacementGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2PlacementGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2PlacementGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-route.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-route.go new file mode 100644 index 0000000000..d39ec253ab --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-route.go @@ -0,0 +1,150 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2Route AWS CloudFormation Resource (AWS::EC2::Route) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html +type AWSEC2Route struct { + + // DestinationCidrBlock AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-destinationcidrblock + DestinationCidrBlock string `json:"DestinationCidrBlock,omitempty"` + + // DestinationIpv6CidrBlock AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-destinationipv6cidrblock + DestinationIpv6CidrBlock string `json:"DestinationIpv6CidrBlock,omitempty"` + + // GatewayId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-gatewayid + GatewayId string `json:"GatewayId,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-instanceid + InstanceId string `json:"InstanceId,omitempty"` + + // NatGatewayId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-natgatewayid + NatGatewayId string `json:"NatGatewayId,omitempty"` + + // NetworkInterfaceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-networkinterfaceid + NetworkInterfaceId string `json:"NetworkInterfaceId,omitempty"` + + // RouteTableId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-routetableid + RouteTableId string `json:"RouteTableId,omitempty"` + + // VpcPeeringConnectionId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-vpcpeeringconnectionid + VpcPeeringConnectionId string `json:"VpcPeeringConnectionId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Route) AWSCloudFormationType() string { + return "AWS::EC2::Route" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Route) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2Route) MarshalJSON() ([]byte, error) { + type Properties AWSEC2Route + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2Route) UnmarshalJSON(b []byte) error { + type Properties AWSEC2Route + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2Route(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2RouteResources retrieves all AWSEC2Route items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2RouteResources() map[string]AWSEC2Route { + results := map[string]AWSEC2Route{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2Route: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Route" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Route + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2RouteWithName retrieves all AWSEC2Route items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2RouteWithName(name string) (AWSEC2Route, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2Route: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Route" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Route + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2Route{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-routetable.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-routetable.go new file mode 100644 index 0000000000..ce25db62d0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-routetable.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2RouteTable AWS CloudFormation Resource (AWS::EC2::RouteTable) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html +type AWSEC2RouteTable struct { + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html#cfn-ec2-routetable-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html#cfn-ec2-routetable-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2RouteTable) AWSCloudFormationType() string { + return "AWS::EC2::RouteTable" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2RouteTable) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2RouteTable) MarshalJSON() ([]byte, error) { + type Properties AWSEC2RouteTable + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2RouteTable) UnmarshalJSON(b []byte) error { + type Properties AWSEC2RouteTable + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2RouteTable(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2RouteTableResources retrieves all AWSEC2RouteTable items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2RouteTableResources() map[string]AWSEC2RouteTable { + results := map[string]AWSEC2RouteTable{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2RouteTable: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::RouteTable" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2RouteTable + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2RouteTableWithName retrieves all AWSEC2RouteTable items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2RouteTableWithName(name string) (AWSEC2RouteTable, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2RouteTable: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::RouteTable" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2RouteTable + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2RouteTable{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup.go new file mode 100644 index 0000000000..efc70356af --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2SecurityGroup AWS CloudFormation Resource (AWS::EC2::SecurityGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html +type AWSEC2SecurityGroup struct { + + // GroupDescription AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-groupdescription + GroupDescription string `json:"GroupDescription,omitempty"` + + // GroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-groupname + GroupName string `json:"GroupName,omitempty"` + + // SecurityGroupEgress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-securitygroupegress + SecurityGroupEgress []AWSEC2SecurityGroup_Egress `json:"SecurityGroupEgress,omitempty"` + + // SecurityGroupIngress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-securitygroupingress + SecurityGroupIngress []AWSEC2SecurityGroup_Ingress `json:"SecurityGroupIngress,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroup) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SecurityGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2SecurityGroup) MarshalJSON() ([]byte, error) { + type Properties AWSEC2SecurityGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2SecurityGroup) UnmarshalJSON(b []byte) error { + type Properties AWSEC2SecurityGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2SecurityGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2SecurityGroupResources retrieves all AWSEC2SecurityGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2SecurityGroupResources() map[string]AWSEC2SecurityGroup { + results := map[string]AWSEC2SecurityGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2SecurityGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SecurityGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SecurityGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2SecurityGroupWithName retrieves all AWSEC2SecurityGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2SecurityGroupWithName(name string) (AWSEC2SecurityGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2SecurityGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SecurityGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SecurityGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2SecurityGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup_egress.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup_egress.go new file mode 100644 index 0000000000..028d734f6d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup_egress.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSEC2SecurityGroup_Egress AWS CloudFormation Resource (AWS::EC2::SecurityGroup.Egress) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html +type AWSEC2SecurityGroup_Egress struct { + + // CidrIp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-cidrip + CidrIp string `json:"CidrIp,omitempty"` + + // CidrIpv6 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-cidripv6 + CidrIpv6 string `json:"CidrIpv6,omitempty"` + + // DestinationPrefixListId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-destinationprefixlistid + DestinationPrefixListId string `json:"DestinationPrefixListId,omitempty"` + + // DestinationSecurityGroupId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-destsecgroupid + DestinationSecurityGroupId string `json:"DestinationSecurityGroupId,omitempty"` + + // FromPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-fromport + FromPort int `json:"FromPort,omitempty"` + + // IpProtocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-ipprotocol + IpProtocol string `json:"IpProtocol,omitempty"` + + // ToPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-toport + ToPort int `json:"ToPort,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroup_Egress) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroup.Egress" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SecurityGroup_Egress) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup_ingress.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup_ingress.go new file mode 100644 index 0000000000..59ea4127f1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup_ingress.go @@ -0,0 +1,56 @@ +package cloudformation + +// AWSEC2SecurityGroup_Ingress AWS CloudFormation Resource (AWS::EC2::SecurityGroup.Ingress) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html +type AWSEC2SecurityGroup_Ingress struct { + + // CidrIp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-cidrip + CidrIp string `json:"CidrIp,omitempty"` + + // CidrIpv6 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-cidripv6 + CidrIpv6 string `json:"CidrIpv6,omitempty"` + + // FromPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-fromport + FromPort int `json:"FromPort,omitempty"` + + // IpProtocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-ipprotocol + IpProtocol string `json:"IpProtocol,omitempty"` + + // SourceSecurityGroupId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-sourcesecuritygroupid + SourceSecurityGroupId string `json:"SourceSecurityGroupId,omitempty"` + + // SourceSecurityGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-sourcesecuritygroupname + SourceSecurityGroupName string `json:"SourceSecurityGroupName,omitempty"` + + // SourceSecurityGroupOwnerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-sourcesecuritygroupownerid + SourceSecurityGroupOwnerId string `json:"SourceSecurityGroupOwnerId,omitempty"` + + // ToPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-toport + ToPort int `json:"ToPort,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroup_Ingress) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroup.Ingress" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SecurityGroup_Ingress) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroupegress.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroupegress.go new file mode 100644 index 0000000000..189dc5cef4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroupegress.go @@ -0,0 +1,150 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2SecurityGroupEgress AWS CloudFormation Resource (AWS::EC2::SecurityGroupEgress) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html +type AWSEC2SecurityGroupEgress struct { + + // CidrIp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-cidrip + CidrIp string `json:"CidrIp,omitempty"` + + // CidrIpv6 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-cidripv6 + CidrIpv6 string `json:"CidrIpv6,omitempty"` + + // DestinationPrefixListId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-destinationprefixlistid + DestinationPrefixListId string `json:"DestinationPrefixListId,omitempty"` + + // DestinationSecurityGroupId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-destinationsecuritygroupid + DestinationSecurityGroupId string `json:"DestinationSecurityGroupId,omitempty"` + + // FromPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-fromport + FromPort int `json:"FromPort,omitempty"` + + // GroupId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-groupid + GroupId string `json:"GroupId,omitempty"` + + // IpProtocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-ipprotocol + IpProtocol string `json:"IpProtocol,omitempty"` + + // ToPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-toport + ToPort int `json:"ToPort,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroupEgress) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroupEgress" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SecurityGroupEgress) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2SecurityGroupEgress) MarshalJSON() ([]byte, error) { + type Properties AWSEC2SecurityGroupEgress + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2SecurityGroupEgress) UnmarshalJSON(b []byte) error { + type Properties AWSEC2SecurityGroupEgress + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2SecurityGroupEgress(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2SecurityGroupEgressResources retrieves all AWSEC2SecurityGroupEgress items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2SecurityGroupEgressResources() map[string]AWSEC2SecurityGroupEgress { + results := map[string]AWSEC2SecurityGroupEgress{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2SecurityGroupEgress: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SecurityGroupEgress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SecurityGroupEgress + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2SecurityGroupEgressWithName retrieves all AWSEC2SecurityGroupEgress items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2SecurityGroupEgressWithName(name string) (AWSEC2SecurityGroupEgress, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2SecurityGroupEgress: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SecurityGroupEgress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SecurityGroupEgress + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2SecurityGroupEgress{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroupingress.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroupingress.go new file mode 100644 index 0000000000..b21fb7cedb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroupingress.go @@ -0,0 +1,160 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2SecurityGroupIngress AWS CloudFormation Resource (AWS::EC2::SecurityGroupIngress) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html +type AWSEC2SecurityGroupIngress struct { + + // CidrIp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-cidrip + CidrIp string `json:"CidrIp,omitempty"` + + // CidrIpv6 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-cidripv6 + CidrIpv6 string `json:"CidrIpv6,omitempty"` + + // FromPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-fromport + FromPort int `json:"FromPort,omitempty"` + + // GroupId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-groupid + GroupId string `json:"GroupId,omitempty"` + + // GroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-groupname + GroupName string `json:"GroupName,omitempty"` + + // IpProtocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-ipprotocol + IpProtocol string `json:"IpProtocol,omitempty"` + + // SourceSecurityGroupId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupid + SourceSecurityGroupId string `json:"SourceSecurityGroupId,omitempty"` + + // SourceSecurityGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupname + SourceSecurityGroupName string `json:"SourceSecurityGroupName,omitempty"` + + // SourceSecurityGroupOwnerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupownerid + SourceSecurityGroupOwnerId string `json:"SourceSecurityGroupOwnerId,omitempty"` + + // ToPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-toport + ToPort int `json:"ToPort,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroupIngress) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroupIngress" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SecurityGroupIngress) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2SecurityGroupIngress) MarshalJSON() ([]byte, error) { + type Properties AWSEC2SecurityGroupIngress + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2SecurityGroupIngress) UnmarshalJSON(b []byte) error { + type Properties AWSEC2SecurityGroupIngress + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2SecurityGroupIngress(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2SecurityGroupIngressResources retrieves all AWSEC2SecurityGroupIngress items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2SecurityGroupIngressResources() map[string]AWSEC2SecurityGroupIngress { + results := map[string]AWSEC2SecurityGroupIngress{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2SecurityGroupIngress: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SecurityGroupIngress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SecurityGroupIngress + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2SecurityGroupIngressWithName retrieves all AWSEC2SecurityGroupIngress items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2SecurityGroupIngressWithName(name string) (AWSEC2SecurityGroupIngress, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2SecurityGroupIngress: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SecurityGroupIngress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SecurityGroupIngress + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2SecurityGroupIngress{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet.go new file mode 100644 index 0000000000..ffbf38a912 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2SpotFleet AWS CloudFormation Resource (AWS::EC2::SpotFleet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-spotfleet.html +type AWSEC2SpotFleet struct { + + // SpotFleetRequestConfigData AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-spotfleet.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata + SpotFleetRequestConfigData *AWSEC2SpotFleet_SpotFleetRequestConfigData `json:"SpotFleetRequestConfigData,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2SpotFleet) MarshalJSON() ([]byte, error) { + type Properties AWSEC2SpotFleet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2SpotFleet) UnmarshalJSON(b []byte) error { + type Properties AWSEC2SpotFleet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2SpotFleet(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2SpotFleetResources retrieves all AWSEC2SpotFleet items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2SpotFleetResources() map[string]AWSEC2SpotFleet { + results := map[string]AWSEC2SpotFleet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2SpotFleet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SpotFleet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SpotFleet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2SpotFleetWithName retrieves all AWSEC2SpotFleet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2SpotFleetWithName(name string) (AWSEC2SpotFleet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2SpotFleet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SpotFleet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SpotFleet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2SpotFleet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_blockdevicemapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_blockdevicemapping.go new file mode 100644 index 0000000000..1f4f6c5f8f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_blockdevicemapping.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSEC2SpotFleet_BlockDeviceMapping AWS CloudFormation Resource (AWS::EC2::SpotFleet.BlockDeviceMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html +type AWSEC2SpotFleet_BlockDeviceMapping struct { + + // DeviceName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html#cfn-ec2-spotfleet-blockdevicemapping-devicename + DeviceName string `json:"DeviceName,omitempty"` + + // Ebs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html#cfn-ec2-spotfleet-blockdevicemapping-ebs + Ebs *AWSEC2SpotFleet_EbsBlockDevice `json:"Ebs,omitempty"` + + // NoDevice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html#cfn-ec2-spotfleet-blockdevicemapping-nodevice + NoDevice string `json:"NoDevice,omitempty"` + + // VirtualName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html#cfn-ec2-spotfleet-blockdevicemapping-virtualname + VirtualName string `json:"VirtualName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.BlockDeviceMapping" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_BlockDeviceMapping) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_ebsblockdevice.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_ebsblockdevice.go new file mode 100644 index 0000000000..ad9dfc5397 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_ebsblockdevice.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSEC2SpotFleet_EbsBlockDevice AWS CloudFormation Resource (AWS::EC2::SpotFleet.EbsBlockDevice) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html +type AWSEC2SpotFleet_EbsBlockDevice struct { + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-deleteontermination + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // Encrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-encrypted + Encrypted bool `json:"Encrypted,omitempty"` + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-iops + Iops int `json:"Iops,omitempty"` + + // SnapshotId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-snapshotid + SnapshotId string `json:"SnapshotId,omitempty"` + + // VolumeSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-volumesize + VolumeSize int `json:"VolumeSize,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_EbsBlockDevice) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.EbsBlockDevice" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_EbsBlockDevice) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_groupidentifier.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_groupidentifier.go new file mode 100644 index 0000000000..10352a1afa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_groupidentifier.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEC2SpotFleet_GroupIdentifier AWS CloudFormation Resource (AWS::EC2::SpotFleet.GroupIdentifier) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-securitygroups.html +type AWSEC2SpotFleet_GroupIdentifier struct { + + // GroupId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-securitygroups.html#cfn-ec2-spotfleet-groupidentifier-groupid + GroupId string `json:"GroupId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_GroupIdentifier) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.GroupIdentifier" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_GroupIdentifier) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_iaminstanceprofilespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_iaminstanceprofilespecification.go new file mode 100644 index 0000000000..5de0a86e0e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_iaminstanceprofilespecification.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEC2SpotFleet_IamInstanceProfileSpecification AWS CloudFormation Resource (AWS::EC2::SpotFleet.IamInstanceProfileSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-iaminstanceprofile.html +type AWSEC2SpotFleet_IamInstanceProfileSpecification struct { + + // Arn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-iaminstanceprofile.html#cfn-ec2-spotfleet-iaminstanceprofilespecification-arn + Arn string `json:"Arn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_IamInstanceProfileSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.IamInstanceProfileSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_IamInstanceProfileSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_instanceipv6address.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_instanceipv6address.go new file mode 100644 index 0000000000..254fa0c4fa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_instanceipv6address.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEC2SpotFleet_InstanceIpv6Address AWS CloudFormation Resource (AWS::EC2::SpotFleet.InstanceIpv6Address) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-instanceipv6address.html +type AWSEC2SpotFleet_InstanceIpv6Address struct { + + // Ipv6Address AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-instanceipv6address.html#cfn-ec2-spotfleet-instanceipv6address-ipv6address + Ipv6Address string `json:"Ipv6Address,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_InstanceIpv6Address) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.InstanceIpv6Address" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_InstanceIpv6Address) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_instancenetworkinterfacespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_instancenetworkinterfacespecification.go new file mode 100644 index 0000000000..3fa0a8bd69 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_instancenetworkinterfacespecification.go @@ -0,0 +1,71 @@ +package cloudformation + +// AWSEC2SpotFleet_InstanceNetworkInterfaceSpecification AWS CloudFormation Resource (AWS::EC2::SpotFleet.InstanceNetworkInterfaceSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html +type AWSEC2SpotFleet_InstanceNetworkInterfaceSpecification struct { + + // AssociatePublicIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-associatepublicipaddress + AssociatePublicIpAddress bool `json:"AssociatePublicIpAddress,omitempty"` + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-deleteontermination + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-description + Description string `json:"Description,omitempty"` + + // DeviceIndex AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-deviceindex + DeviceIndex int `json:"DeviceIndex,omitempty"` + + // Groups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-groups + Groups []string `json:"Groups,omitempty"` + + // Ipv6AddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-ipv6addresscount + Ipv6AddressCount int `json:"Ipv6AddressCount,omitempty"` + + // Ipv6Addresses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-ipv6addresses + Ipv6Addresses []AWSEC2SpotFleet_InstanceIpv6Address `json:"Ipv6Addresses,omitempty"` + + // NetworkInterfaceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-networkinterfaceid + NetworkInterfaceId string `json:"NetworkInterfaceId,omitempty"` + + // PrivateIpAddresses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-privateipaddresses + PrivateIpAddresses []AWSEC2SpotFleet_PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty"` + + // SecondaryPrivateIpAddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-secondaryprivateipaddresscount + SecondaryPrivateIpAddressCount int `json:"SecondaryPrivateIpAddressCount,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-subnetid + SubnetId string `json:"SubnetId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_InstanceNetworkInterfaceSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.InstanceNetworkInterfaceSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_InstanceNetworkInterfaceSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_privateipaddressspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_privateipaddressspecification.go new file mode 100644 index 0000000000..d0bd8aff29 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_privateipaddressspecification.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2SpotFleet_PrivateIpAddressSpecification AWS CloudFormation Resource (AWS::EC2::SpotFleet.PrivateIpAddressSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces-privateipaddresses.html +type AWSEC2SpotFleet_PrivateIpAddressSpecification struct { + + // Primary AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces-privateipaddresses.html#cfn-ec2-spotfleet-privateipaddressspecification-primary + Primary bool `json:"Primary,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces-privateipaddresses.html#cfn-ec2-spotfleet-privateipaddressspecification-privateipaddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_PrivateIpAddressSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.PrivateIpAddressSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_PrivateIpAddressSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetlaunchspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetlaunchspecification.go new file mode 100644 index 0000000000..be2968305b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetlaunchspecification.go @@ -0,0 +1,96 @@ +package cloudformation + +// AWSEC2SpotFleet_SpotFleetLaunchSpecification AWS CloudFormation Resource (AWS::EC2::SpotFleet.SpotFleetLaunchSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html +type AWSEC2SpotFleet_SpotFleetLaunchSpecification struct { + + // BlockDeviceMappings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-blockdevicemappings + BlockDeviceMappings []AWSEC2SpotFleet_BlockDeviceMapping `json:"BlockDeviceMappings,omitempty"` + + // EbsOptimized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` + + // IamInstanceProfile AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-iaminstanceprofile + IamInstanceProfile *AWSEC2SpotFleet_IamInstanceProfileSpecification `json:"IamInstanceProfile,omitempty"` + + // ImageId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-imageid + ImageId string `json:"ImageId,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // KernelId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-kernelid + KernelId string `json:"KernelId,omitempty"` + + // KeyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-keyname + KeyName string `json:"KeyName,omitempty"` + + // Monitoring AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-monitoring + Monitoring *AWSEC2SpotFleet_SpotFleetMonitoring `json:"Monitoring,omitempty"` + + // NetworkInterfaces AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-networkinterfaces + NetworkInterfaces []AWSEC2SpotFleet_InstanceNetworkInterfaceSpecification `json:"NetworkInterfaces,omitempty"` + + // Placement AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-placement + Placement *AWSEC2SpotFleet_SpotPlacement `json:"Placement,omitempty"` + + // RamdiskId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-ramdiskid + RamdiskId string `json:"RamdiskId,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-securitygroups + SecurityGroups []AWSEC2SpotFleet_GroupIdentifier `json:"SecurityGroups,omitempty"` + + // SpotPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-spotprice + SpotPrice string `json:"SpotPrice,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // UserData AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-userdata + UserData string `json:"UserData,omitempty"` + + // WeightedCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-weightedcapacity + WeightedCapacity float64 `json:"WeightedCapacity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotFleetLaunchSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotFleetLaunchSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_SpotFleetLaunchSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetmonitoring.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetmonitoring.go new file mode 100644 index 0000000000..7a9d68c560 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetmonitoring.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEC2SpotFleet_SpotFleetMonitoring AWS CloudFormation Resource (AWS::EC2::SpotFleet.SpotFleetMonitoring) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-monitoring.html +type AWSEC2SpotFleet_SpotFleetMonitoring struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-monitoring.html#cfn-ec2-spotfleet-spotfleetmonitoring-enabled + Enabled bool `json:"Enabled,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotFleetMonitoring) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotFleetMonitoring" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_SpotFleetMonitoring) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetrequestconfigdata.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetrequestconfigdata.go new file mode 100644 index 0000000000..7d69f3dd9c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetrequestconfigdata.go @@ -0,0 +1,61 @@ +package cloudformation + +// AWSEC2SpotFleet_SpotFleetRequestConfigData AWS CloudFormation Resource (AWS::EC2::SpotFleet.SpotFleetRequestConfigData) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html +type AWSEC2SpotFleet_SpotFleetRequestConfigData struct { + + // AllocationStrategy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-allocationstrategy + AllocationStrategy string `json:"AllocationStrategy,omitempty"` + + // ExcessCapacityTerminationPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-excesscapacityterminationpolicy + ExcessCapacityTerminationPolicy string `json:"ExcessCapacityTerminationPolicy,omitempty"` + + // IamFleetRole AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-iamfleetrole + IamFleetRole string `json:"IamFleetRole,omitempty"` + + // LaunchSpecifications AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications + LaunchSpecifications []AWSEC2SpotFleet_SpotFleetLaunchSpecification `json:"LaunchSpecifications,omitempty"` + + // SpotPrice AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-spotprice + SpotPrice string `json:"SpotPrice,omitempty"` + + // TargetCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-targetcapacity + TargetCapacity int `json:"TargetCapacity,omitempty"` + + // TerminateInstancesWithExpiration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-terminateinstanceswithexpiration + TerminateInstancesWithExpiration bool `json:"TerminateInstancesWithExpiration,omitempty"` + + // ValidFrom AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-validfrom + ValidFrom string `json:"ValidFrom,omitempty"` + + // ValidUntil AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-validuntil + ValidUntil string `json:"ValidUntil,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotFleetRequestConfigData) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotFleetRequestConfigData" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_SpotFleetRequestConfigData) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotplacement.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotplacement.go new file mode 100644 index 0000000000..34ae9166d5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotplacement.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEC2SpotFleet_SpotPlacement AWS CloudFormation Resource (AWS::EC2::SpotFleet.SpotPlacement) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-placement.html +type AWSEC2SpotFleet_SpotPlacement struct { + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-placement.html#cfn-ec2-spotfleet-spotplacement-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // GroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-placement.html#cfn-ec2-spotfleet-spotplacement-groupname + GroupName string `json:"GroupName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotPlacement) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotPlacement" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SpotFleet_SpotPlacement) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnet.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnet.go new file mode 100644 index 0000000000..2ed77360d9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnet.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2Subnet AWS CloudFormation Resource (AWS::EC2::Subnet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html +type AWSEC2Subnet struct { + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // CidrBlock AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-cidrblock + CidrBlock string `json:"CidrBlock,omitempty"` + + // MapPublicIpOnLaunch AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-mappubliciponlaunch + MapPublicIpOnLaunch bool `json:"MapPublicIpOnLaunch,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-awsec2subnet-prop-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Subnet) AWSCloudFormationType() string { + return "AWS::EC2::Subnet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Subnet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2Subnet) MarshalJSON() ([]byte, error) { + type Properties AWSEC2Subnet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2Subnet) UnmarshalJSON(b []byte) error { + type Properties AWSEC2Subnet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2Subnet(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2SubnetResources retrieves all AWSEC2Subnet items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2SubnetResources() map[string]AWSEC2Subnet { + results := map[string]AWSEC2Subnet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2Subnet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Subnet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Subnet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2SubnetWithName retrieves all AWSEC2Subnet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2SubnetWithName(name string) (AWSEC2Subnet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2Subnet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Subnet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Subnet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2Subnet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetcidrblock.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetcidrblock.go new file mode 100644 index 0000000000..2f7cdd7f90 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetcidrblock.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2SubnetCidrBlock AWS CloudFormation Resource (AWS::EC2::SubnetCidrBlock) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html +type AWSEC2SubnetCidrBlock struct { + + // Ipv6CidrBlock AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html#cfn-ec2-subnetcidrblock-ipv6cidrblock + Ipv6CidrBlock string `json:"Ipv6CidrBlock,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html#cfn-ec2-subnetcidrblock-subnetid + SubnetId string `json:"SubnetId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SubnetCidrBlock) AWSCloudFormationType() string { + return "AWS::EC2::SubnetCidrBlock" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SubnetCidrBlock) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2SubnetCidrBlock) MarshalJSON() ([]byte, error) { + type Properties AWSEC2SubnetCidrBlock + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2SubnetCidrBlock) UnmarshalJSON(b []byte) error { + type Properties AWSEC2SubnetCidrBlock + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2SubnetCidrBlock(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2SubnetCidrBlockResources retrieves all AWSEC2SubnetCidrBlock items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2SubnetCidrBlockResources() map[string]AWSEC2SubnetCidrBlock { + results := map[string]AWSEC2SubnetCidrBlock{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2SubnetCidrBlock: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SubnetCidrBlock" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SubnetCidrBlock + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2SubnetCidrBlockWithName retrieves all AWSEC2SubnetCidrBlock items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2SubnetCidrBlockWithName(name string) (AWSEC2SubnetCidrBlock, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2SubnetCidrBlock: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SubnetCidrBlock" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SubnetCidrBlock + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2SubnetCidrBlock{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetnetworkaclassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetnetworkaclassociation.go new file mode 100644 index 0000000000..ee1a34a484 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetnetworkaclassociation.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2SubnetNetworkAclAssociation AWS CloudFormation Resource (AWS::EC2::SubnetNetworkAclAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html +type AWSEC2SubnetNetworkAclAssociation struct { + + // NetworkAclId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html#cfn-ec2-subnetnetworkaclassociation-networkaclid + NetworkAclId string `json:"NetworkAclId,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html#cfn-ec2-subnetnetworkaclassociation-associationid + SubnetId string `json:"SubnetId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SubnetNetworkAclAssociation) AWSCloudFormationType() string { + return "AWS::EC2::SubnetNetworkAclAssociation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SubnetNetworkAclAssociation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2SubnetNetworkAclAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSEC2SubnetNetworkAclAssociation + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2SubnetNetworkAclAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSEC2SubnetNetworkAclAssociation + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2SubnetNetworkAclAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2SubnetNetworkAclAssociationResources retrieves all AWSEC2SubnetNetworkAclAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2SubnetNetworkAclAssociationResources() map[string]AWSEC2SubnetNetworkAclAssociation { + results := map[string]AWSEC2SubnetNetworkAclAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2SubnetNetworkAclAssociation: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SubnetNetworkAclAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SubnetNetworkAclAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2SubnetNetworkAclAssociationWithName retrieves all AWSEC2SubnetNetworkAclAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2SubnetNetworkAclAssociationWithName(name string) (AWSEC2SubnetNetworkAclAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2SubnetNetworkAclAssociation: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SubnetNetworkAclAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SubnetNetworkAclAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2SubnetNetworkAclAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetroutetableassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetroutetableassociation.go new file mode 100644 index 0000000000..9e6d18e80e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetroutetableassociation.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2SubnetRouteTableAssociation AWS CloudFormation Resource (AWS::EC2::SubnetRouteTableAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html +type AWSEC2SubnetRouteTableAssociation struct { + + // RouteTableId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html#cfn-ec2-subnetroutetableassociation-routetableid + RouteTableId string `json:"RouteTableId,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html#cfn-ec2-subnetroutetableassociation-subnetid + SubnetId string `json:"SubnetId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SubnetRouteTableAssociation) AWSCloudFormationType() string { + return "AWS::EC2::SubnetRouteTableAssociation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2SubnetRouteTableAssociation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2SubnetRouteTableAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSEC2SubnetRouteTableAssociation + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2SubnetRouteTableAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSEC2SubnetRouteTableAssociation + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2SubnetRouteTableAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2SubnetRouteTableAssociationResources retrieves all AWSEC2SubnetRouteTableAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2SubnetRouteTableAssociationResources() map[string]AWSEC2SubnetRouteTableAssociation { + results := map[string]AWSEC2SubnetRouteTableAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2SubnetRouteTableAssociation: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SubnetRouteTableAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SubnetRouteTableAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2SubnetRouteTableAssociationWithName retrieves all AWSEC2SubnetRouteTableAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2SubnetRouteTableAssociationWithName(name string) (AWSEC2SubnetRouteTableAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2SubnetRouteTableAssociation: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::SubnetRouteTableAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2SubnetRouteTableAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2SubnetRouteTableAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-trunkinterfaceassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-trunkinterfaceassociation.go new file mode 100644 index 0000000000..e69a001448 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-trunkinterfaceassociation.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2TrunkInterfaceAssociation AWS CloudFormation Resource (AWS::EC2::TrunkInterfaceAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trunkinterfaceassociation.html +type AWSEC2TrunkInterfaceAssociation struct { + + // BranchInterfaceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trunkinterfaceassociation.html#cfn-ec2-trunkinterfaceassociation-branchinterfaceid + BranchInterfaceId string `json:"BranchInterfaceId,omitempty"` + + // GREKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trunkinterfaceassociation.html#cfn-ec2-trunkinterfaceassociation-grekey + GREKey int `json:"GREKey,omitempty"` + + // TrunkInterfaceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trunkinterfaceassociation.html#cfn-ec2-trunkinterfaceassociation-trunkinterfaceid + TrunkInterfaceId string `json:"TrunkInterfaceId,omitempty"` + + // VLANId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trunkinterfaceassociation.html#cfn-ec2-trunkinterfaceassociation-vlanid + VLANId int `json:"VLANId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2TrunkInterfaceAssociation) AWSCloudFormationType() string { + return "AWS::EC2::TrunkInterfaceAssociation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2TrunkInterfaceAssociation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2TrunkInterfaceAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSEC2TrunkInterfaceAssociation + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2TrunkInterfaceAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSEC2TrunkInterfaceAssociation + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2TrunkInterfaceAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2TrunkInterfaceAssociationResources retrieves all AWSEC2TrunkInterfaceAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2TrunkInterfaceAssociationResources() map[string]AWSEC2TrunkInterfaceAssociation { + results := map[string]AWSEC2TrunkInterfaceAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2TrunkInterfaceAssociation: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::TrunkInterfaceAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2TrunkInterfaceAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2TrunkInterfaceAssociationWithName retrieves all AWSEC2TrunkInterfaceAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2TrunkInterfaceAssociationWithName(name string) (AWSEC2TrunkInterfaceAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2TrunkInterfaceAssociation: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::TrunkInterfaceAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2TrunkInterfaceAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2TrunkInterfaceAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-volume.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-volume.go new file mode 100644 index 0000000000..5487f40e1e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-volume.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2Volume AWS CloudFormation Resource (AWS::EC2::Volume) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html +type AWSEC2Volume struct { + + // AutoEnableIO AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-autoenableio + AutoEnableIO bool `json:"AutoEnableIO,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // Encrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-encrypted + Encrypted bool `json:"Encrypted,omitempty"` + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-iops + Iops int `json:"Iops,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // Size AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-size + Size int `json:"Size,omitempty"` + + // SnapshotId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-snapshotid + SnapshotId string `json:"SnapshotId,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-tags + Tags []Tag `json:"Tags,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Volume) AWSCloudFormationType() string { + return "AWS::EC2::Volume" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2Volume) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2Volume) MarshalJSON() ([]byte, error) { + type Properties AWSEC2Volume + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2Volume) UnmarshalJSON(b []byte) error { + type Properties AWSEC2Volume + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2Volume(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VolumeResources retrieves all AWSEC2Volume items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VolumeResources() map[string]AWSEC2Volume { + results := map[string]AWSEC2Volume{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2Volume: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Volume" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Volume + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VolumeWithName retrieves all AWSEC2Volume items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VolumeWithName(name string) (AWSEC2Volume, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2Volume: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::Volume" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2Volume + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2Volume{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-volumeattachment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-volumeattachment.go new file mode 100644 index 0000000000..2bae8682ce --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-volumeattachment.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VolumeAttachment AWS CloudFormation Resource (AWS::EC2::VolumeAttachment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html +type AWSEC2VolumeAttachment struct { + + // Device AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-device + Device string `json:"Device,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-instanceid + InstanceId string `json:"InstanceId,omitempty"` + + // VolumeId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-volumeid + VolumeId string `json:"VolumeId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VolumeAttachment) AWSCloudFormationType() string { + return "AWS::EC2::VolumeAttachment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VolumeAttachment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VolumeAttachment) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VolumeAttachment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VolumeAttachment) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VolumeAttachment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VolumeAttachment(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VolumeAttachmentResources retrieves all AWSEC2VolumeAttachment items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VolumeAttachmentResources() map[string]AWSEC2VolumeAttachment { + results := map[string]AWSEC2VolumeAttachment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VolumeAttachment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VolumeAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VolumeAttachment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VolumeAttachmentWithName retrieves all AWSEC2VolumeAttachment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VolumeAttachmentWithName(name string) (AWSEC2VolumeAttachment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VolumeAttachment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VolumeAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VolumeAttachment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VolumeAttachment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpc.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpc.go new file mode 100644 index 0000000000..db89658257 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpc.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPC AWS CloudFormation Resource (AWS::EC2::VPC) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html +type AWSEC2VPC struct { + + // CidrBlock AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-cidrblock + CidrBlock string `json:"CidrBlock,omitempty"` + + // EnableDnsHostnames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-EnableDnsHostnames + EnableDnsHostnames bool `json:"EnableDnsHostnames,omitempty"` + + // EnableDnsSupport AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-EnableDnsSupport + EnableDnsSupport bool `json:"EnableDnsSupport,omitempty"` + + // InstanceTenancy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-instancetenancy + InstanceTenancy string `json:"InstanceTenancy,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPC) AWSCloudFormationType() string { + return "AWS::EC2::VPC" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPC) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPC) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPC + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPC) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPC + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPC(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPCResources retrieves all AWSEC2VPC items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPCResources() map[string]AWSEC2VPC { + results := map[string]AWSEC2VPC{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPC: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPC" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPC + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPCWithName retrieves all AWSEC2VPC items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPCWithName(name string) (AWSEC2VPC, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPC: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPC" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPC + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPC{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpccidrblock.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpccidrblock.go new file mode 100644 index 0000000000..7be4f13305 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpccidrblock.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPCCidrBlock AWS CloudFormation Resource (AWS::EC2::VPCCidrBlock) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html +type AWSEC2VPCCidrBlock struct { + + // AmazonProvidedIpv6CidrBlock AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-amazonprovidedipv6cidrblock + AmazonProvidedIpv6CidrBlock bool `json:"AmazonProvidedIpv6CidrBlock,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCCidrBlock) AWSCloudFormationType() string { + return "AWS::EC2::VPCCidrBlock" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPCCidrBlock) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPCCidrBlock) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPCCidrBlock + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPCCidrBlock) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPCCidrBlock + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPCCidrBlock(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPCCidrBlockResources retrieves all AWSEC2VPCCidrBlock items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPCCidrBlockResources() map[string]AWSEC2VPCCidrBlock { + results := map[string]AWSEC2VPCCidrBlock{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPCCidrBlock: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCCidrBlock" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCCidrBlock + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPCCidrBlockWithName retrieves all AWSEC2VPCCidrBlock items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPCCidrBlockWithName(name string) (AWSEC2VPCCidrBlock, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPCCidrBlock: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCCidrBlock" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCCidrBlock + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPCCidrBlock{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcdhcpoptionsassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcdhcpoptionsassociation.go new file mode 100644 index 0000000000..6d390e9080 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcdhcpoptionsassociation.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPCDHCPOptionsAssociation AWS CloudFormation Resource (AWS::EC2::VPCDHCPOptionsAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html +type AWSEC2VPCDHCPOptionsAssociation struct { + + // DhcpOptionsId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html#cfn-ec2-vpcdhcpoptionsassociation-dhcpoptionsid + DhcpOptionsId string `json:"DhcpOptionsId,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html#cfn-ec2-vpcdhcpoptionsassociation-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCDHCPOptionsAssociation) AWSCloudFormationType() string { + return "AWS::EC2::VPCDHCPOptionsAssociation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPCDHCPOptionsAssociation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPCDHCPOptionsAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPCDHCPOptionsAssociation + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPCDHCPOptionsAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPCDHCPOptionsAssociation + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPCDHCPOptionsAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPCDHCPOptionsAssociationResources retrieves all AWSEC2VPCDHCPOptionsAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPCDHCPOptionsAssociationResources() map[string]AWSEC2VPCDHCPOptionsAssociation { + results := map[string]AWSEC2VPCDHCPOptionsAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPCDHCPOptionsAssociation: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCDHCPOptionsAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCDHCPOptionsAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPCDHCPOptionsAssociationWithName retrieves all AWSEC2VPCDHCPOptionsAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPCDHCPOptionsAssociationWithName(name string) (AWSEC2VPCDHCPOptionsAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPCDHCPOptionsAssociation: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCDHCPOptionsAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCDHCPOptionsAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPCDHCPOptionsAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpoint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpoint.go new file mode 100644 index 0000000000..1ea39b0e35 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpoint.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPCEndpoint AWS CloudFormation Resource (AWS::EC2::VPCEndpoint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html +type AWSEC2VPCEndpoint struct { + + // PolicyDocument AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // RouteTableIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-routetableids + RouteTableIds []string `json:"RouteTableIds,omitempty"` + + // ServiceName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-servicename + ServiceName string `json:"ServiceName,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCEndpoint) AWSCloudFormationType() string { + return "AWS::EC2::VPCEndpoint" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPCEndpoint) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPCEndpoint) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPCEndpoint + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPCEndpoint) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPCEndpoint + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPCEndpoint(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPCEndpointResources retrieves all AWSEC2VPCEndpoint items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPCEndpointResources() map[string]AWSEC2VPCEndpoint { + results := map[string]AWSEC2VPCEndpoint{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPCEndpoint: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCEndpoint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCEndpoint + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPCEndpointWithName retrieves all AWSEC2VPCEndpoint items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPCEndpointWithName(name string) (AWSEC2VPCEndpoint, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPCEndpoint: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCEndpoint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCEndpoint + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPCEndpoint{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcgatewayattachment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcgatewayattachment.go new file mode 100644 index 0000000000..918ef608f1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcgatewayattachment.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPCGatewayAttachment AWS CloudFormation Resource (AWS::EC2::VPCGatewayAttachment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html +type AWSEC2VPCGatewayAttachment struct { + + // InternetGatewayId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-internetgatewayid + InternetGatewayId string `json:"InternetGatewayId,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-vpcid + VpcId string `json:"VpcId,omitempty"` + + // VpnGatewayId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-vpngatewayid + VpnGatewayId string `json:"VpnGatewayId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCGatewayAttachment) AWSCloudFormationType() string { + return "AWS::EC2::VPCGatewayAttachment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPCGatewayAttachment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPCGatewayAttachment) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPCGatewayAttachment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPCGatewayAttachment) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPCGatewayAttachment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPCGatewayAttachment(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPCGatewayAttachmentResources retrieves all AWSEC2VPCGatewayAttachment items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPCGatewayAttachmentResources() map[string]AWSEC2VPCGatewayAttachment { + results := map[string]AWSEC2VPCGatewayAttachment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPCGatewayAttachment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCGatewayAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCGatewayAttachment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPCGatewayAttachmentWithName retrieves all AWSEC2VPCGatewayAttachment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPCGatewayAttachmentWithName(name string) (AWSEC2VPCGatewayAttachment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPCGatewayAttachment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCGatewayAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCGatewayAttachment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPCGatewayAttachment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcpeeringconnection.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcpeeringconnection.go new file mode 100644 index 0000000000..64e93cd155 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcpeeringconnection.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPCPeeringConnection AWS CloudFormation Resource (AWS::EC2::VPCPeeringConnection) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html +type AWSEC2VPCPeeringConnection struct { + + // PeerOwnerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerownerid + PeerOwnerId string `json:"PeerOwnerId,omitempty"` + + // PeerRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerrolearn + PeerRoleArn string `json:"PeerRoleArn,omitempty"` + + // PeerVpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peervpcid + PeerVpcId string `json:"PeerVpcId,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCPeeringConnection) AWSCloudFormationType() string { + return "AWS::EC2::VPCPeeringConnection" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPCPeeringConnection) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPCPeeringConnection) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPCPeeringConnection + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPCPeeringConnection) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPCPeeringConnection + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPCPeeringConnection(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPCPeeringConnectionResources retrieves all AWSEC2VPCPeeringConnection items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPCPeeringConnectionResources() map[string]AWSEC2VPCPeeringConnection { + results := map[string]AWSEC2VPCPeeringConnection{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPCPeeringConnection: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCPeeringConnection" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCPeeringConnection + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPCPeeringConnectionWithName retrieves all AWSEC2VPCPeeringConnection items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPCPeeringConnectionWithName(name string) (AWSEC2VPCPeeringConnection, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPCPeeringConnection: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPCPeeringConnection" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCPeeringConnection + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPCPeeringConnection{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnection.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnection.go new file mode 100644 index 0000000000..347fa9e4a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnection.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPNConnection AWS CloudFormation Resource (AWS::EC2::VPNConnection) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html +type AWSEC2VPNConnection struct { + + // CustomerGatewayId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-customergatewayid + CustomerGatewayId string `json:"CustomerGatewayId,omitempty"` + + // StaticRoutesOnly AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-StaticRoutesOnly + StaticRoutesOnly bool `json:"StaticRoutesOnly,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-tags + Tags []Tag `json:"Tags,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-type + Type string `json:"Type,omitempty"` + + // VpnGatewayId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-vpngatewayid + VpnGatewayId string `json:"VpnGatewayId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNConnection) AWSCloudFormationType() string { + return "AWS::EC2::VPNConnection" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPNConnection) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPNConnection) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPNConnection + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPNConnection) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPNConnection + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPNConnection(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPNConnectionResources retrieves all AWSEC2VPNConnection items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPNConnectionResources() map[string]AWSEC2VPNConnection { + results := map[string]AWSEC2VPNConnection{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPNConnection: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPNConnection" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPNConnection + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPNConnectionWithName retrieves all AWSEC2VPNConnection items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPNConnectionWithName(name string) (AWSEC2VPNConnection, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPNConnection: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPNConnection" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPNConnection + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPNConnection{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnectionroute.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnectionroute.go new file mode 100644 index 0000000000..dbb1b1240e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnectionroute.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPNConnectionRoute AWS CloudFormation Resource (AWS::EC2::VPNConnectionRoute) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html +type AWSEC2VPNConnectionRoute struct { + + // DestinationCidrBlock AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html#cfn-ec2-vpnconnectionroute-cidrblock + DestinationCidrBlock string `json:"DestinationCidrBlock,omitempty"` + + // VpnConnectionId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html#cfn-ec2-vpnconnectionroute-connectionid + VpnConnectionId string `json:"VpnConnectionId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNConnectionRoute) AWSCloudFormationType() string { + return "AWS::EC2::VPNConnectionRoute" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPNConnectionRoute) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPNConnectionRoute) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPNConnectionRoute + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPNConnectionRoute) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPNConnectionRoute + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPNConnectionRoute(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPNConnectionRouteResources retrieves all AWSEC2VPNConnectionRoute items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPNConnectionRouteResources() map[string]AWSEC2VPNConnectionRoute { + results := map[string]AWSEC2VPNConnectionRoute{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPNConnectionRoute: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPNConnectionRoute" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPNConnectionRoute + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPNConnectionRouteWithName retrieves all AWSEC2VPNConnectionRoute items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPNConnectionRouteWithName(name string) (AWSEC2VPNConnectionRoute, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPNConnectionRoute: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPNConnectionRoute" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPNConnectionRoute + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPNConnectionRoute{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpngateway.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpngateway.go new file mode 100644 index 0000000000..d3b587161d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpngateway.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPNGateway AWS CloudFormation Resource (AWS::EC2::VPNGateway) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html +type AWSEC2VPNGateway struct { + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-tags + Tags []Tag `json:"Tags,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNGateway) AWSCloudFormationType() string { + return "AWS::EC2::VPNGateway" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPNGateway) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPNGateway) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPNGateway + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPNGateway) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPNGateway + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPNGateway(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPNGatewayResources retrieves all AWSEC2VPNGateway items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPNGatewayResources() map[string]AWSEC2VPNGateway { + results := map[string]AWSEC2VPNGateway{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPNGateway: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPNGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPNGateway + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPNGatewayWithName retrieves all AWSEC2VPNGateway items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPNGatewayWithName(name string) (AWSEC2VPNGateway, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPNGateway: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPNGateway" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPNGateway + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPNGateway{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpngatewayroutepropagation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpngatewayroutepropagation.go new file mode 100644 index 0000000000..d8adae9250 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpngatewayroutepropagation.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPNGatewayRoutePropagation AWS CloudFormation Resource (AWS::EC2::VPNGatewayRoutePropagation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html +type AWSEC2VPNGatewayRoutePropagation struct { + + // RouteTableIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html#cfn-ec2-vpngatewayrouteprop-routetableids + RouteTableIds []string `json:"RouteTableIds,omitempty"` + + // VpnGatewayId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html#cfn-ec2-vpngatewayrouteprop-vpngatewayid + VpnGatewayId string `json:"VpnGatewayId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNGatewayRoutePropagation) AWSCloudFormationType() string { + return "AWS::EC2::VPNGatewayRoutePropagation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEC2VPNGatewayRoutePropagation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEC2VPNGatewayRoutePropagation) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPNGatewayRoutePropagation + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPNGatewayRoutePropagation) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPNGatewayRoutePropagation + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEC2VPNGatewayRoutePropagation(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPNGatewayRoutePropagationResources retrieves all AWSEC2VPNGatewayRoutePropagation items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPNGatewayRoutePropagationResources() map[string]AWSEC2VPNGatewayRoutePropagation { + results := map[string]AWSEC2VPNGatewayRoutePropagation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPNGatewayRoutePropagation: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPNGatewayRoutePropagation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPNGatewayRoutePropagation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPNGatewayRoutePropagationWithName retrieves all AWSEC2VPNGatewayRoutePropagation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPNGatewayRoutePropagationWithName(name string) (AWSEC2VPNGatewayRoutePropagation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPNGatewayRoutePropagation: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EC2::VPNGatewayRoutePropagation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPNGatewayRoutePropagation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPNGatewayRoutePropagation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecr-repository.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecr-repository.go new file mode 100644 index 0000000000..ee142643ed --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecr-repository.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSECRRepository AWS CloudFormation Resource (AWS::ECR::Repository) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecr-repository.html +type AWSECRRepository struct { + + // RepositoryName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecr-repository.html#cfn-ecr-repository-repositoryname + RepositoryName string `json:"RepositoryName,omitempty"` + + // RepositoryPolicyText AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecr-repository.html#cfn-ecr-repository-repositorypolicytext + RepositoryPolicyText interface{} `json:"RepositoryPolicyText,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECRRepository) AWSCloudFormationType() string { + return "AWS::ECR::Repository" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECRRepository) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSECRRepository) MarshalJSON() ([]byte, error) { + type Properties AWSECRRepository + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSECRRepository) UnmarshalJSON(b []byte) error { + type Properties AWSECRRepository + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSECRRepository(*res.Properties) + } + + return nil +} + +// GetAllAWSECRRepositoryResources retrieves all AWSECRRepository items from an AWS CloudFormation template +func (t *Template) GetAllAWSECRRepositoryResources() map[string]AWSECRRepository { + results := map[string]AWSECRRepository{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSECRRepository: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ECR::Repository" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSECRRepository + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSECRRepositoryWithName retrieves all AWSECRRepository items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSECRRepositoryWithName(name string) (AWSECRRepository, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSECRRepository: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ECR::Repository" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSECRRepository + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSECRRepository{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-cluster.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-cluster.go new file mode 100644 index 0000000000..4c7694f029 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-cluster.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSECSCluster AWS CloudFormation Resource (AWS::ECS::Cluster) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html +type AWSECSCluster struct { + + // ClusterName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html#cfn-ecs-cluster-clustername + ClusterName string `json:"ClusterName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSCluster) AWSCloudFormationType() string { + return "AWS::ECS::Cluster" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSCluster) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSECSCluster) MarshalJSON() ([]byte, error) { + type Properties AWSECSCluster + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSECSCluster) UnmarshalJSON(b []byte) error { + type Properties AWSECSCluster + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSECSCluster(*res.Properties) + } + + return nil +} + +// GetAllAWSECSClusterResources retrieves all AWSECSCluster items from an AWS CloudFormation template +func (t *Template) GetAllAWSECSClusterResources() map[string]AWSECSCluster { + results := map[string]AWSECSCluster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSECSCluster: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ECS::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSECSCluster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSECSClusterWithName retrieves all AWSECSCluster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSECSClusterWithName(name string) (AWSECSCluster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSECSCluster: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ECS::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSECSCluster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSECSCluster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service.go new file mode 100644 index 0000000000..c9a2262911 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSECSService AWS CloudFormation Resource (AWS::ECS::Service) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html +type AWSECSService struct { + + // Cluster AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-cluster + Cluster string `json:"Cluster,omitempty"` + + // DeploymentConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-deploymentconfiguration + DeploymentConfiguration *AWSECSService_DeploymentConfiguration `json:"DeploymentConfiguration,omitempty"` + + // DesiredCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-desiredcount + DesiredCount int `json:"DesiredCount,omitempty"` + + // LoadBalancers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-loadbalancers + LoadBalancers []AWSECSService_LoadBalancer `json:"LoadBalancers,omitempty"` + + // PlacementConstraints AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-placementconstraints + PlacementConstraints []AWSECSService_PlacementConstraint `json:"PlacementConstraints,omitempty"` + + // PlacementStrategies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-placementstrategies + PlacementStrategies []AWSECSService_PlacementStrategy `json:"PlacementStrategies,omitempty"` + + // Role AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-role + Role string `json:"Role,omitempty"` + + // ServiceName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-servicename + ServiceName string `json:"ServiceName,omitempty"` + + // TaskDefinition AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-taskdefinition + TaskDefinition string `json:"TaskDefinition,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService) AWSCloudFormationType() string { + return "AWS::ECS::Service" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSService) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSECSService) MarshalJSON() ([]byte, error) { + type Properties AWSECSService + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSECSService) UnmarshalJSON(b []byte) error { + type Properties AWSECSService + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSECSService(*res.Properties) + } + + return nil +} + +// GetAllAWSECSServiceResources retrieves all AWSECSService items from an AWS CloudFormation template +func (t *Template) GetAllAWSECSServiceResources() map[string]AWSECSService { + results := map[string]AWSECSService{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSECSService: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ECS::Service" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSECSService + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSECSServiceWithName retrieves all AWSECSService items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSECSServiceWithName(name string) (AWSECSService, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSECSService: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ECS::Service" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSECSService + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSECSService{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_deploymentconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_deploymentconfiguration.go new file mode 100644 index 0000000000..f3d6188092 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_deploymentconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSService_DeploymentConfiguration AWS CloudFormation Resource (AWS::ECS::Service.DeploymentConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-deploymentconfiguration.html +type AWSECSService_DeploymentConfiguration struct { + + // MaximumPercent AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-deploymentconfiguration.html#cfn-ecs-service-deploymentconfiguration-maximumpercent + MaximumPercent int `json:"MaximumPercent,omitempty"` + + // MinimumHealthyPercent AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-deploymentconfiguration.html#cfn-ecs-service-deploymentconfiguration-minimumhealthypercent + MinimumHealthyPercent int `json:"MinimumHealthyPercent,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_DeploymentConfiguration) AWSCloudFormationType() string { + return "AWS::ECS::Service.DeploymentConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSService_DeploymentConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_loadbalancer.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_loadbalancer.go new file mode 100644 index 0000000000..de2e232888 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_loadbalancer.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSECSService_LoadBalancer AWS CloudFormation Resource (AWS::ECS::Service.LoadBalancer) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-loadbalancers.html +type AWSECSService_LoadBalancer struct { + + // ContainerName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-loadbalancers.html#cfn-ecs-service-loadbalancers-containername + ContainerName string `json:"ContainerName,omitempty"` + + // ContainerPort AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-loadbalancers.html#cfn-ecs-service-loadbalancers-containerport + ContainerPort int `json:"ContainerPort,omitempty"` + + // LoadBalancerName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-loadbalancers.html#cfn-ecs-service-loadbalancers-loadbalancername + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + + // TargetGroupArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-loadbalancers.html#cfn-ecs-service-loadbalancers-targetgrouparn + TargetGroupArn string `json:"TargetGroupArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_LoadBalancer) AWSCloudFormationType() string { + return "AWS::ECS::Service.LoadBalancer" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSService_LoadBalancer) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_placementconstraint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_placementconstraint.go new file mode 100644 index 0000000000..d8ee85fa0b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_placementconstraint.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSService_PlacementConstraint AWS CloudFormation Resource (AWS::ECS::Service.PlacementConstraint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-placementconstraint.html +type AWSECSService_PlacementConstraint struct { + + // Expression AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-placementconstraint.html#cfn-ecs-service-placementconstraint-expression + Expression string `json:"Expression,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-placementconstraint.html#cfn-ecs-service-placementconstraint-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_PlacementConstraint) AWSCloudFormationType() string { + return "AWS::ECS::Service.PlacementConstraint" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSService_PlacementConstraint) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_placementstrategy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_placementstrategy.go new file mode 100644 index 0000000000..dcf7f47b1e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_placementstrategy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSService_PlacementStrategy AWS CloudFormation Resource (AWS::ECS::Service.PlacementStrategy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-placementstrategy.html +type AWSECSService_PlacementStrategy struct { + + // Field AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-placementstrategy.html#cfn-ecs-service-placementstrategy-field + Field string `json:"Field,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-placementstrategy.html#cfn-ecs-service-placementstrategy-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_PlacementStrategy) AWSCloudFormationType() string { + return "AWS::ECS::Service.PlacementStrategy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSService_PlacementStrategy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition.go new file mode 100644 index 0000000000..b01fe5411c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSECSTaskDefinition AWS CloudFormation Resource (AWS::ECS::TaskDefinition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html +type AWSECSTaskDefinition struct { + + // ContainerDefinitions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-containerdefinitions + ContainerDefinitions []AWSECSTaskDefinition_ContainerDefinition `json:"ContainerDefinitions,omitempty"` + + // Family AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-family + Family string `json:"Family,omitempty"` + + // NetworkMode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-networkmode + NetworkMode string `json:"NetworkMode,omitempty"` + + // PlacementConstraints AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-placementconstraints + PlacementConstraints []AWSECSTaskDefinition_TaskDefinitionPlacementConstraint `json:"PlacementConstraints,omitempty"` + + // TaskRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-taskrolearn + TaskRoleArn string `json:"TaskRoleArn,omitempty"` + + // Volumes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-volumes + Volumes []AWSECSTaskDefinition_Volume `json:"Volumes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSECSTaskDefinition) MarshalJSON() ([]byte, error) { + type Properties AWSECSTaskDefinition + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSECSTaskDefinition) UnmarshalJSON(b []byte) error { + type Properties AWSECSTaskDefinition + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSECSTaskDefinition(*res.Properties) + } + + return nil +} + +// GetAllAWSECSTaskDefinitionResources retrieves all AWSECSTaskDefinition items from an AWS CloudFormation template +func (t *Template) GetAllAWSECSTaskDefinitionResources() map[string]AWSECSTaskDefinition { + results := map[string]AWSECSTaskDefinition{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSECSTaskDefinition: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ECS::TaskDefinition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSECSTaskDefinition + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSECSTaskDefinitionWithName retrieves all AWSECSTaskDefinition items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSECSTaskDefinitionWithName(name string) (AWSECSTaskDefinition, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSECSTaskDefinition: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ECS::TaskDefinition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSECSTaskDefinition + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSECSTaskDefinition{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_containerdefinition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_containerdefinition.go new file mode 100644 index 0000000000..f79448c3bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_containerdefinition.go @@ -0,0 +1,146 @@ +package cloudformation + +// AWSECSTaskDefinition_ContainerDefinition AWS CloudFormation Resource (AWS::ECS::TaskDefinition.ContainerDefinition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html +type AWSECSTaskDefinition_ContainerDefinition struct { + + // Command AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-command + Command []string `json:"Command,omitempty"` + + // Cpu AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-cpu + Cpu int `json:"Cpu,omitempty"` + + // DisableNetworking AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-disablenetworking + DisableNetworking bool `json:"DisableNetworking,omitempty"` + + // DnsSearchDomains AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dnssearchdomains + DnsSearchDomains []string `json:"DnsSearchDomains,omitempty"` + + // DnsServers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dnsservers + DnsServers []string `json:"DnsServers,omitempty"` + + // DockerLabels AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dockerlabels + DockerLabels map[string]string `json:"DockerLabels,omitempty"` + + // DockerSecurityOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-dockersecurityoptions + DockerSecurityOptions []string `json:"DockerSecurityOptions,omitempty"` + + // EntryPoint AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-entrypoint + EntryPoint []string `json:"EntryPoint,omitempty"` + + // Environment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-environment + Environment []AWSECSTaskDefinition_KeyValuePair `json:"Environment,omitempty"` + + // Essential AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-essential + Essential bool `json:"Essential,omitempty"` + + // ExtraHosts AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-extrahosts + ExtraHosts []AWSECSTaskDefinition_HostEntry `json:"ExtraHosts,omitempty"` + + // Hostname AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-hostname + Hostname string `json:"Hostname,omitempty"` + + // Image AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-image + Image string `json:"Image,omitempty"` + + // Links AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-links + Links []string `json:"Links,omitempty"` + + // LogConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-logconfiguration + LogConfiguration *AWSECSTaskDefinition_LogConfiguration `json:"LogConfiguration,omitempty"` + + // Memory AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-memory + Memory int `json:"Memory,omitempty"` + + // MemoryReservation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-memoryreservation + MemoryReservation int `json:"MemoryReservation,omitempty"` + + // MountPoints AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-mountpoints + MountPoints []AWSECSTaskDefinition_MountPoint `json:"MountPoints,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-name + Name string `json:"Name,omitempty"` + + // PortMappings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-portmappings + PortMappings []AWSECSTaskDefinition_PortMapping `json:"PortMappings,omitempty"` + + // Privileged AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-privileged + Privileged bool `json:"Privileged,omitempty"` + + // ReadonlyRootFilesystem AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-readonlyrootfilesystem + ReadonlyRootFilesystem bool `json:"ReadonlyRootFilesystem,omitempty"` + + // Ulimits AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-ulimits + Ulimits []AWSECSTaskDefinition_Ulimit `json:"Ulimits,omitempty"` + + // User AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-user + User string `json:"User,omitempty"` + + // VolumesFrom AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-volumesfrom + VolumesFrom []AWSECSTaskDefinition_VolumeFrom `json:"VolumesFrom,omitempty"` + + // WorkingDirectory AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-workingdirectory + WorkingDirectory string `json:"WorkingDirectory,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_ContainerDefinition) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.ContainerDefinition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_ContainerDefinition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_hostentry.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_hostentry.go new file mode 100644 index 0000000000..add92b9fa0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_hostentry.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSTaskDefinition_HostEntry AWS CloudFormation Resource (AWS::ECS::TaskDefinition.HostEntry) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-hostentry.html +type AWSECSTaskDefinition_HostEntry struct { + + // Hostname AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-hostentry.html#cfn-ecs-taskdefinition-containerdefinition-hostentry-hostname + Hostname string `json:"Hostname,omitempty"` + + // IpAddress AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-hostentry.html#cfn-ecs-taskdefinition-containerdefinition-hostentry-ipaddress + IpAddress string `json:"IpAddress,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_HostEntry) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.HostEntry" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_HostEntry) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_hostvolumeproperties.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_hostvolumeproperties.go new file mode 100644 index 0000000000..442cbbb7d8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_hostvolumeproperties.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSECSTaskDefinition_HostVolumeProperties AWS CloudFormation Resource (AWS::ECS::TaskDefinition.HostVolumeProperties) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes-host.html +type AWSECSTaskDefinition_HostVolumeProperties struct { + + // SourcePath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes-host.html#cfn-ecs-taskdefinition-volumes-host-sourcepath + SourcePath string `json:"SourcePath,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_HostVolumeProperties) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.HostVolumeProperties" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_HostVolumeProperties) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_keyvaluepair.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_keyvaluepair.go new file mode 100644 index 0000000000..3f35438303 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_keyvaluepair.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSTaskDefinition_KeyValuePair AWS CloudFormation Resource (AWS::ECS::TaskDefinition.KeyValuePair) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-environment.html +type AWSECSTaskDefinition_KeyValuePair struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-environment.html#cfn-ecs-taskdefinition-containerdefinition-environment-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-environment.html#cfn-ecs-taskdefinition-containerdefinition-environment-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_KeyValuePair) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.KeyValuePair" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_KeyValuePair) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_logconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_logconfiguration.go new file mode 100644 index 0000000000..0cb3762e77 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_logconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSTaskDefinition_LogConfiguration AWS CloudFormation Resource (AWS::ECS::TaskDefinition.LogConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-logconfiguration.html +type AWSECSTaskDefinition_LogConfiguration struct { + + // LogDriver AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-logconfiguration.html#cfn-ecs-taskdefinition-containerdefinition-logconfiguration-logdriver + LogDriver string `json:"LogDriver,omitempty"` + + // Options AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-logconfiguration.html#cfn-ecs-taskdefinition-containerdefinition-logconfiguration-options + Options map[string]string `json:"Options,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_LogConfiguration) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.LogConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_LogConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_mountpoint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_mountpoint.go new file mode 100644 index 0000000000..557d45a207 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_mountpoint.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSECSTaskDefinition_MountPoint AWS CloudFormation Resource (AWS::ECS::TaskDefinition.MountPoint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-mountpoints.html +type AWSECSTaskDefinition_MountPoint struct { + + // ContainerPath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-mountpoints.html#cfn-ecs-taskdefinition-containerdefinition-mountpoints-containerpath + ContainerPath string `json:"ContainerPath,omitempty"` + + // ReadOnly AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-mountpoints.html#cfn-ecs-taskdefinition-containerdefinition-mountpoints-readonly + ReadOnly bool `json:"ReadOnly,omitempty"` + + // SourceVolume AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-mountpoints.html#cfn-ecs-taskdefinition-containerdefinition-mountpoints-sourcevolume + SourceVolume string `json:"SourceVolume,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_MountPoint) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.MountPoint" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_MountPoint) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_portmapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_portmapping.go new file mode 100644 index 0000000000..fc3b176b5a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_portmapping.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSECSTaskDefinition_PortMapping AWS CloudFormation Resource (AWS::ECS::TaskDefinition.PortMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-portmappings.html +type AWSECSTaskDefinition_PortMapping struct { + + // ContainerPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-portmappings.html#cfn-ecs-taskdefinition-containerdefinition-portmappings-containerport + ContainerPort int `json:"ContainerPort,omitempty"` + + // HostPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-portmappings.html#cfn-ecs-taskdefinition-containerdefinition-portmappings-readonly + HostPort int `json:"HostPort,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-portmappings.html#cfn-ecs-taskdefinition-containerdefinition-portmappings-sourcevolume + Protocol string `json:"Protocol,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_PortMapping) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.PortMapping" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_PortMapping) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_taskdefinitionplacementconstraint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_taskdefinitionplacementconstraint.go new file mode 100644 index 0000000000..91ed8acd54 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_taskdefinitionplacementconstraint.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSTaskDefinition_TaskDefinitionPlacementConstraint AWS CloudFormation Resource (AWS::ECS::TaskDefinition.TaskDefinitionPlacementConstraint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-taskdefinitionplacementconstraint.html +type AWSECSTaskDefinition_TaskDefinitionPlacementConstraint struct { + + // Expression AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-taskdefinitionplacementconstraint.html#cfn-ecs-taskdefinition-taskdefinitionplacementconstraint-expression + Expression string `json:"Expression,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-taskdefinitionplacementconstraint.html#cfn-ecs-taskdefinition-taskdefinitionplacementconstraint-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_TaskDefinitionPlacementConstraint) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.TaskDefinitionPlacementConstraint" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_TaskDefinitionPlacementConstraint) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_ulimit.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_ulimit.go new file mode 100644 index 0000000000..40f3485895 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_ulimit.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSECSTaskDefinition_Ulimit AWS CloudFormation Resource (AWS::ECS::TaskDefinition.Ulimit) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-ulimit.html +type AWSECSTaskDefinition_Ulimit struct { + + // HardLimit AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-ulimit.html#cfn-ecs-taskdefinition-containerdefinition-ulimit-hardlimit + HardLimit int `json:"HardLimit,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-ulimit.html#cfn-ecs-taskdefinition-containerdefinition-ulimit-name + Name string `json:"Name,omitempty"` + + // SoftLimit AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-ulimit.html#cfn-ecs-taskdefinition-containerdefinition-ulimit-softlimit + SoftLimit int `json:"SoftLimit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_Ulimit) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.Ulimit" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_Ulimit) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_volume.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_volume.go new file mode 100644 index 0000000000..5044e0fc7c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_volume.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSTaskDefinition_Volume AWS CloudFormation Resource (AWS::ECS::TaskDefinition.Volume) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes.html +type AWSECSTaskDefinition_Volume struct { + + // Host AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes.html#cfn-ecs-taskdefinition-volumes-host + Host *AWSECSTaskDefinition_HostVolumeProperties `json:"Host,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-volumes.html#cfn-ecs-taskdefinition-volumes-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_Volume) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.Volume" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_Volume) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_volumefrom.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_volumefrom.go new file mode 100644 index 0000000000..934f44f7f5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_volumefrom.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSECSTaskDefinition_VolumeFrom AWS CloudFormation Resource (AWS::ECS::TaskDefinition.VolumeFrom) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-volumesfrom.html +type AWSECSTaskDefinition_VolumeFrom struct { + + // ReadOnly AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-volumesfrom.html#cfn-ecs-taskdefinition-containerdefinition-volumesfrom-readonly + ReadOnly bool `json:"ReadOnly,omitempty"` + + // SourceContainer AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-volumesfrom.html#cfn-ecs-taskdefinition-containerdefinition-volumesfrom-sourcecontainer + SourceContainer string `json:"SourceContainer,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_VolumeFrom) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.VolumeFrom" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSECSTaskDefinition_VolumeFrom) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-filesystem.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-filesystem.go new file mode 100644 index 0000000000..bfcff3ec4d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-filesystem.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEFSFileSystem AWS CloudFormation Resource (AWS::EFS::FileSystem) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html +type AWSEFSFileSystem struct { + + // FileSystemTags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-efs-filesystem-filesystemtags + FileSystemTags []AWSEFSFileSystem_ElasticFileSystemTag `json:"FileSystemTags,omitempty"` + + // PerformanceMode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-efs-filesystem-performancemode + PerformanceMode string `json:"PerformanceMode,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEFSFileSystem) AWSCloudFormationType() string { + return "AWS::EFS::FileSystem" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEFSFileSystem) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEFSFileSystem) MarshalJSON() ([]byte, error) { + type Properties AWSEFSFileSystem + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEFSFileSystem) UnmarshalJSON(b []byte) error { + type Properties AWSEFSFileSystem + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEFSFileSystem(*res.Properties) + } + + return nil +} + +// GetAllAWSEFSFileSystemResources retrieves all AWSEFSFileSystem items from an AWS CloudFormation template +func (t *Template) GetAllAWSEFSFileSystemResources() map[string]AWSEFSFileSystem { + results := map[string]AWSEFSFileSystem{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEFSFileSystem: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EFS::FileSystem" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEFSFileSystem + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEFSFileSystemWithName retrieves all AWSEFSFileSystem items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEFSFileSystemWithName(name string) (AWSEFSFileSystem, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEFSFileSystem: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EFS::FileSystem" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEFSFileSystem + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEFSFileSystem{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-filesystem_elasticfilesystemtag.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-filesystem_elasticfilesystemtag.go new file mode 100644 index 0000000000..a7ff3adf98 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-filesystem_elasticfilesystemtag.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEFSFileSystem_ElasticFileSystemTag AWS CloudFormation Resource (AWS::EFS::FileSystem.ElasticFileSystemTag) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-efs-filesystem-filesystemtags.html +type AWSEFSFileSystem_ElasticFileSystemTag struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-efs-filesystem-filesystemtags.html#cfn-efs-filesystem-filesystemtags-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-efs-filesystem-filesystemtags.html#cfn-efs-filesystem-filesystemtags-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEFSFileSystem_ElasticFileSystemTag) AWSCloudFormationType() string { + return "AWS::EFS::FileSystem.ElasticFileSystemTag" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEFSFileSystem_ElasticFileSystemTag) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-mounttarget.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-mounttarget.go new file mode 100644 index 0000000000..06ac0f2097 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-mounttarget.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEFSMountTarget AWS CloudFormation Resource (AWS::EFS::MountTarget) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-mounttarget.html +type AWSEFSMountTarget struct { + + // FileSystemId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-mounttarget.html#cfn-efs-mounttarget-filesystemid + FileSystemId string `json:"FileSystemId,omitempty"` + + // IpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-mounttarget.html#cfn-efs-mounttarget-ipaddress + IpAddress string `json:"IpAddress,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-mounttarget.html#cfn-efs-mounttarget-securitygroups + SecurityGroups []string `json:"SecurityGroups,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-mounttarget.html#cfn-efs-mounttarget-subnetid + SubnetId string `json:"SubnetId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEFSMountTarget) AWSCloudFormationType() string { + return "AWS::EFS::MountTarget" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEFSMountTarget) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEFSMountTarget) MarshalJSON() ([]byte, error) { + type Properties AWSEFSMountTarget + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEFSMountTarget) UnmarshalJSON(b []byte) error { + type Properties AWSEFSMountTarget + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEFSMountTarget(*res.Properties) + } + + return nil +} + +// GetAllAWSEFSMountTargetResources retrieves all AWSEFSMountTarget items from an AWS CloudFormation template +func (t *Template) GetAllAWSEFSMountTargetResources() map[string]AWSEFSMountTarget { + results := map[string]AWSEFSMountTarget{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEFSMountTarget: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EFS::MountTarget" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEFSMountTarget + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEFSMountTargetWithName retrieves all AWSEFSMountTarget items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEFSMountTargetWithName(name string) (AWSEFSMountTarget, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEFSMountTarget: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EFS::MountTarget" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEFSMountTarget + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEFSMountTarget{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-cachecluster.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-cachecluster.go new file mode 100644 index 0000000000..c2344a5616 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-cachecluster.go @@ -0,0 +1,215 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElastiCacheCacheCluster AWS CloudFormation Resource (AWS::ElastiCache::CacheCluster) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html +type AWSElastiCacheCacheCluster struct { + + // AZMode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-azmode + AZMode string `json:"AZMode,omitempty"` + + // AutoMinorVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-autominorversionupgrade + AutoMinorVersionUpgrade bool `json:"AutoMinorVersionUpgrade,omitempty"` + + // CacheNodeType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-cachenodetype + CacheNodeType string `json:"CacheNodeType,omitempty"` + + // CacheParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-cacheparametergroupname + CacheParameterGroupName string `json:"CacheParameterGroupName,omitempty"` + + // CacheSecurityGroupNames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-cachesecuritygroupnames + CacheSecurityGroupNames []string `json:"CacheSecurityGroupNames,omitempty"` + + // CacheSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-cachesubnetgroupname + CacheSubnetGroupName string `json:"CacheSubnetGroupName,omitempty"` + + // ClusterName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-clustername + ClusterName string `json:"ClusterName,omitempty"` + + // Engine AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-engine + Engine string `json:"Engine,omitempty"` + + // EngineVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-engineversion + EngineVersion string `json:"EngineVersion,omitempty"` + + // NotificationTopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-notificationtopicarn + NotificationTopicArn string `json:"NotificationTopicArn,omitempty"` + + // NumCacheNodes AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-numcachenodes + NumCacheNodes int `json:"NumCacheNodes,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-port + Port int `json:"Port,omitempty"` + + // PreferredAvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-preferredavailabilityzone + PreferredAvailabilityZone string `json:"PreferredAvailabilityZone,omitempty"` + + // PreferredAvailabilityZones AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-preferredavailabilityzones + PreferredAvailabilityZones []string `json:"PreferredAvailabilityZones,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // SnapshotArns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-snapshotarns + SnapshotArns []string `json:"SnapshotArns,omitempty"` + + // SnapshotName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-snapshotname + SnapshotName string `json:"SnapshotName,omitempty"` + + // SnapshotRetentionLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-snapshotretentionlimit + SnapshotRetentionLimit int `json:"SnapshotRetentionLimit,omitempty"` + + // SnapshotWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-snapshotwindow + SnapshotWindow string `json:"SnapshotWindow,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcSecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-vpcsecuritygroupids + VpcSecurityGroupIds []string `json:"VpcSecurityGroupIds,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheCacheCluster) AWSCloudFormationType() string { + return "AWS::ElastiCache::CacheCluster" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElastiCacheCacheCluster) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElastiCacheCacheCluster) MarshalJSON() ([]byte, error) { + type Properties AWSElastiCacheCacheCluster + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElastiCacheCacheCluster) UnmarshalJSON(b []byte) error { + type Properties AWSElastiCacheCacheCluster + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElastiCacheCacheCluster(*res.Properties) + } + + return nil +} + +// GetAllAWSElastiCacheCacheClusterResources retrieves all AWSElastiCacheCacheCluster items from an AWS CloudFormation template +func (t *Template) GetAllAWSElastiCacheCacheClusterResources() map[string]AWSElastiCacheCacheCluster { + results := map[string]AWSElastiCacheCacheCluster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElastiCacheCacheCluster: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::CacheCluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheCacheCluster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElastiCacheCacheClusterWithName retrieves all AWSElastiCacheCacheCluster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElastiCacheCacheClusterWithName(name string) (AWSElastiCacheCacheCluster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElastiCacheCacheCluster: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::CacheCluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheCacheCluster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElastiCacheCacheCluster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-parametergroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-parametergroup.go new file mode 100644 index 0000000000..cc2c36b8eb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-parametergroup.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElastiCacheParameterGroup AWS CloudFormation Resource (AWS::ElastiCache::ParameterGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html +type AWSElastiCacheParameterGroup struct { + + // CacheParameterGroupFamily AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html#cfn-elasticache-parametergroup-cacheparametergroupfamily + CacheParameterGroupFamily string `json:"CacheParameterGroupFamily,omitempty"` + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html#cfn-elasticache-parametergroup-description + Description string `json:"Description,omitempty"` + + // Properties AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html#cfn-elasticache-parametergroup-properties + Properties map[string]string `json:"Properties,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheParameterGroup) AWSCloudFormationType() string { + return "AWS::ElastiCache::ParameterGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElastiCacheParameterGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElastiCacheParameterGroup) MarshalJSON() ([]byte, error) { + type Properties AWSElastiCacheParameterGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElastiCacheParameterGroup) UnmarshalJSON(b []byte) error { + type Properties AWSElastiCacheParameterGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElastiCacheParameterGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSElastiCacheParameterGroupResources retrieves all AWSElastiCacheParameterGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSElastiCacheParameterGroupResources() map[string]AWSElastiCacheParameterGroup { + results := map[string]AWSElastiCacheParameterGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElastiCacheParameterGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::ParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElastiCacheParameterGroupWithName retrieves all AWSElastiCacheParameterGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElastiCacheParameterGroupWithName(name string) (AWSElastiCacheParameterGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElastiCacheParameterGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::ParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElastiCacheParameterGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-replicationgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-replicationgroup.go new file mode 100644 index 0000000000..104d5ed779 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-replicationgroup.go @@ -0,0 +1,240 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElastiCacheReplicationGroup AWS CloudFormation Resource (AWS::ElastiCache::ReplicationGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html +type AWSElastiCacheReplicationGroup struct { + + // AutoMinorVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-autominorversionupgrade + AutoMinorVersionUpgrade bool `json:"AutoMinorVersionUpgrade,omitempty"` + + // AutomaticFailoverEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-automaticfailoverenabled + AutomaticFailoverEnabled bool `json:"AutomaticFailoverEnabled,omitempty"` + + // CacheNodeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-cachenodetype + CacheNodeType string `json:"CacheNodeType,omitempty"` + + // CacheParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-cacheparametergroupname + CacheParameterGroupName string `json:"CacheParameterGroupName,omitempty"` + + // CacheSecurityGroupNames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-cachesecuritygroupnames + CacheSecurityGroupNames []string `json:"CacheSecurityGroupNames,omitempty"` + + // CacheSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-cachesubnetgroupname + CacheSubnetGroupName string `json:"CacheSubnetGroupName,omitempty"` + + // Engine AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-engine + Engine string `json:"Engine,omitempty"` + + // EngineVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-engineversion + EngineVersion string `json:"EngineVersion,omitempty"` + + // NodeGroupConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-nodegroupconfiguration + NodeGroupConfiguration []AWSElastiCacheReplicationGroup_NodeGroupConfiguration `json:"NodeGroupConfiguration,omitempty"` + + // NotificationTopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-notificationtopicarn + NotificationTopicArn string `json:"NotificationTopicArn,omitempty"` + + // NumCacheClusters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-numcacheclusters + NumCacheClusters int `json:"NumCacheClusters,omitempty"` + + // NumNodeGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-numnodegroups + NumNodeGroups int `json:"NumNodeGroups,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-port + Port int `json:"Port,omitempty"` + + // PreferredCacheClusterAZs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-preferredcacheclusterazs + PreferredCacheClusterAZs []string `json:"PreferredCacheClusterAZs,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // PrimaryClusterId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-primaryclusterid + PrimaryClusterId string `json:"PrimaryClusterId,omitempty"` + + // ReplicasPerNodeGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-replicaspernodegroup + ReplicasPerNodeGroup int `json:"ReplicasPerNodeGroup,omitempty"` + + // ReplicationGroupDescription AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-replicationgroupdescription + ReplicationGroupDescription string `json:"ReplicationGroupDescription,omitempty"` + + // ReplicationGroupId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-replicationgroupid + ReplicationGroupId string `json:"ReplicationGroupId,omitempty"` + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SnapshotArns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-snapshotarns + SnapshotArns []string `json:"SnapshotArns,omitempty"` + + // SnapshotName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-snapshotname + SnapshotName string `json:"SnapshotName,omitempty"` + + // SnapshotRetentionLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-snapshotretentionlimit + SnapshotRetentionLimit int `json:"SnapshotRetentionLimit,omitempty"` + + // SnapshotWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-snapshotwindow + SnapshotWindow string `json:"SnapshotWindow,omitempty"` + + // SnapshottingClusterId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-snapshottingclusterid + SnapshottingClusterId string `json:"SnapshottingClusterId,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheReplicationGroup) AWSCloudFormationType() string { + return "AWS::ElastiCache::ReplicationGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElastiCacheReplicationGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElastiCacheReplicationGroup) MarshalJSON() ([]byte, error) { + type Properties AWSElastiCacheReplicationGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElastiCacheReplicationGroup) UnmarshalJSON(b []byte) error { + type Properties AWSElastiCacheReplicationGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElastiCacheReplicationGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSElastiCacheReplicationGroupResources retrieves all AWSElastiCacheReplicationGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSElastiCacheReplicationGroupResources() map[string]AWSElastiCacheReplicationGroup { + results := map[string]AWSElastiCacheReplicationGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElastiCacheReplicationGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::ReplicationGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheReplicationGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElastiCacheReplicationGroupWithName retrieves all AWSElastiCacheReplicationGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElastiCacheReplicationGroupWithName(name string) (AWSElastiCacheReplicationGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElastiCacheReplicationGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::ReplicationGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheReplicationGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElastiCacheReplicationGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-replicationgroup_nodegroupconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-replicationgroup_nodegroupconfiguration.go new file mode 100644 index 0000000000..9a2be99b86 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-replicationgroup_nodegroupconfiguration.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSElastiCacheReplicationGroup_NodeGroupConfiguration AWS CloudFormation Resource (AWS::ElastiCache::ReplicationGroup.NodeGroupConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-replicationgroup-nodegroupconfiguration.html +type AWSElastiCacheReplicationGroup_NodeGroupConfiguration struct { + + // PrimaryAvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-replicationgroup-nodegroupconfiguration.html#cfn-elasticache-replicationgroup-nodegroupconfiguration-primaryavailabilityzone + PrimaryAvailabilityZone string `json:"PrimaryAvailabilityZone,omitempty"` + + // ReplicaAvailabilityZones AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-replicationgroup-nodegroupconfiguration.html#cfn-elasticache-replicationgroup-nodegroupconfiguration-replicaavailabilityzones + ReplicaAvailabilityZones []string `json:"ReplicaAvailabilityZones,omitempty"` + + // ReplicaCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-replicationgroup-nodegroupconfiguration.html#cfn-elasticache-replicationgroup-nodegroupconfiguration-replicacount + ReplicaCount int `json:"ReplicaCount,omitempty"` + + // Slots AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-replicationgroup-nodegroupconfiguration.html#cfn-elasticache-replicationgroup-nodegroupconfiguration-slots + Slots string `json:"Slots,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheReplicationGroup_NodeGroupConfiguration) AWSCloudFormationType() string { + return "AWS::ElastiCache::ReplicationGroup.NodeGroupConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElastiCacheReplicationGroup_NodeGroupConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-securitygroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-securitygroup.go new file mode 100644 index 0000000000..be571b6075 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-securitygroup.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElastiCacheSecurityGroup AWS CloudFormation Resource (AWS::ElastiCache::SecurityGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-security-group.html +type AWSElastiCacheSecurityGroup struct { + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-security-group.html#cfn-elasticache-securitygroup-description + Description string `json:"Description,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheSecurityGroup) AWSCloudFormationType() string { + return "AWS::ElastiCache::SecurityGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElastiCacheSecurityGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElastiCacheSecurityGroup) MarshalJSON() ([]byte, error) { + type Properties AWSElastiCacheSecurityGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElastiCacheSecurityGroup) UnmarshalJSON(b []byte) error { + type Properties AWSElastiCacheSecurityGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElastiCacheSecurityGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSElastiCacheSecurityGroupResources retrieves all AWSElastiCacheSecurityGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSElastiCacheSecurityGroupResources() map[string]AWSElastiCacheSecurityGroup { + results := map[string]AWSElastiCacheSecurityGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElastiCacheSecurityGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::SecurityGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheSecurityGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElastiCacheSecurityGroupWithName retrieves all AWSElastiCacheSecurityGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElastiCacheSecurityGroupWithName(name string) (AWSElastiCacheSecurityGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElastiCacheSecurityGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::SecurityGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheSecurityGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElastiCacheSecurityGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-securitygroupingress.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-securitygroupingress.go new file mode 100644 index 0000000000..ea32ae9339 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-securitygroupingress.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElastiCacheSecurityGroupIngress AWS CloudFormation Resource (AWS::ElastiCache::SecurityGroupIngress) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-security-group-ingress.html +type AWSElastiCacheSecurityGroupIngress struct { + + // CacheSecurityGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-security-group-ingress.html#cfn-elasticache-securitygroupingress-cachesecuritygroupname + CacheSecurityGroupName string `json:"CacheSecurityGroupName,omitempty"` + + // EC2SecurityGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-security-group-ingress.html#cfn-elasticache-securitygroupingress-ec2securitygroupname + EC2SecurityGroupName string `json:"EC2SecurityGroupName,omitempty"` + + // EC2SecurityGroupOwnerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-security-group-ingress.html#cfn-elasticache-securitygroupingress-ec2securitygroupownerid + EC2SecurityGroupOwnerId string `json:"EC2SecurityGroupOwnerId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheSecurityGroupIngress) AWSCloudFormationType() string { + return "AWS::ElastiCache::SecurityGroupIngress" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElastiCacheSecurityGroupIngress) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElastiCacheSecurityGroupIngress) MarshalJSON() ([]byte, error) { + type Properties AWSElastiCacheSecurityGroupIngress + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElastiCacheSecurityGroupIngress) UnmarshalJSON(b []byte) error { + type Properties AWSElastiCacheSecurityGroupIngress + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElastiCacheSecurityGroupIngress(*res.Properties) + } + + return nil +} + +// GetAllAWSElastiCacheSecurityGroupIngressResources retrieves all AWSElastiCacheSecurityGroupIngress items from an AWS CloudFormation template +func (t *Template) GetAllAWSElastiCacheSecurityGroupIngressResources() map[string]AWSElastiCacheSecurityGroupIngress { + results := map[string]AWSElastiCacheSecurityGroupIngress{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElastiCacheSecurityGroupIngress: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::SecurityGroupIngress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheSecurityGroupIngress + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElastiCacheSecurityGroupIngressWithName retrieves all AWSElastiCacheSecurityGroupIngress items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElastiCacheSecurityGroupIngressWithName(name string) (AWSElastiCacheSecurityGroupIngress, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElastiCacheSecurityGroupIngress: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::SecurityGroupIngress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheSecurityGroupIngress + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElastiCacheSecurityGroupIngress{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-subnetgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-subnetgroup.go new file mode 100644 index 0000000000..b991a6333d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-subnetgroup.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElastiCacheSubnetGroup AWS CloudFormation Resource (AWS::ElastiCache::SubnetGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html +type AWSElastiCacheSubnetGroup struct { + + // CacheSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html#cfn-elasticache-subnetgroup-cachesubnetgroupname + CacheSubnetGroupName string `json:"CacheSubnetGroupName,omitempty"` + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html#cfn-elasticache-subnetgroup-description + Description string `json:"Description,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html#cfn-elasticache-subnetgroup-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheSubnetGroup) AWSCloudFormationType() string { + return "AWS::ElastiCache::SubnetGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElastiCacheSubnetGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElastiCacheSubnetGroup) MarshalJSON() ([]byte, error) { + type Properties AWSElastiCacheSubnetGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElastiCacheSubnetGroup) UnmarshalJSON(b []byte) error { + type Properties AWSElastiCacheSubnetGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElastiCacheSubnetGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSElastiCacheSubnetGroupResources retrieves all AWSElastiCacheSubnetGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSElastiCacheSubnetGroupResources() map[string]AWSElastiCacheSubnetGroup { + results := map[string]AWSElastiCacheSubnetGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElastiCacheSubnetGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::SubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElastiCacheSubnetGroupWithName retrieves all AWSElastiCacheSubnetGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElastiCacheSubnetGroupWithName(name string) (AWSElastiCacheSubnetGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElastiCacheSubnetGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElastiCache::SubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElastiCacheSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElastiCacheSubnetGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application.go new file mode 100644 index 0000000000..e31d25f9e2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticBeanstalkApplication AWS CloudFormation Resource (AWS::ElasticBeanstalk::Application) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk.html +type AWSElasticBeanstalkApplication struct { + + // ApplicationName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk.html#cfn-elasticbeanstalk-application-name + ApplicationName string `json:"ApplicationName,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk.html#cfn-elasticbeanstalk-application-description + Description string `json:"Description,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplication) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Application" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkApplication) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticBeanstalkApplication) MarshalJSON() ([]byte, error) { + type Properties AWSElasticBeanstalkApplication + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticBeanstalkApplication) UnmarshalJSON(b []byte) error { + type Properties AWSElasticBeanstalkApplication + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticBeanstalkApplication(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticBeanstalkApplicationResources retrieves all AWSElasticBeanstalkApplication items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticBeanstalkApplicationResources() map[string]AWSElasticBeanstalkApplication { + results := map[string]AWSElasticBeanstalkApplication{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticBeanstalkApplication: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticBeanstalk::Application" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticBeanstalkApplication + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticBeanstalkApplicationWithName retrieves all AWSElasticBeanstalkApplication items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticBeanstalkApplicationWithName(name string) (AWSElasticBeanstalkApplication, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticBeanstalkApplication: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticBeanstalk::Application" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticBeanstalkApplication + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticBeanstalkApplication{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-applicationversion.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-applicationversion.go new file mode 100644 index 0000000000..39036ebfb2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-applicationversion.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticBeanstalkApplicationVersion AWS CloudFormation Resource (AWS::ElasticBeanstalk::ApplicationVersion) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-version.html +type AWSElasticBeanstalkApplicationVersion struct { + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-version.html#cfn-elasticbeanstalk-applicationversion-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-version.html#cfn-elasticbeanstalk-applicationversion-description + Description string `json:"Description,omitempty"` + + // SourceBundle AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-version.html#cfn-elasticbeanstalk-applicationversion-sourcebundle + SourceBundle *AWSElasticBeanstalkApplicationVersion_SourceBundle `json:"SourceBundle,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplicationVersion) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ApplicationVersion" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkApplicationVersion) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticBeanstalkApplicationVersion) MarshalJSON() ([]byte, error) { + type Properties AWSElasticBeanstalkApplicationVersion + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticBeanstalkApplicationVersion) UnmarshalJSON(b []byte) error { + type Properties AWSElasticBeanstalkApplicationVersion + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticBeanstalkApplicationVersion(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticBeanstalkApplicationVersionResources retrieves all AWSElasticBeanstalkApplicationVersion items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticBeanstalkApplicationVersionResources() map[string]AWSElasticBeanstalkApplicationVersion { + results := map[string]AWSElasticBeanstalkApplicationVersion{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticBeanstalkApplicationVersion: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticBeanstalk::ApplicationVersion" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticBeanstalkApplicationVersion + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticBeanstalkApplicationVersionWithName retrieves all AWSElasticBeanstalkApplicationVersion items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticBeanstalkApplicationVersionWithName(name string) (AWSElasticBeanstalkApplicationVersion, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticBeanstalkApplicationVersion: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticBeanstalk::ApplicationVersion" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticBeanstalkApplicationVersion + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticBeanstalkApplicationVersion{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-applicationversion_sourcebundle.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-applicationversion_sourcebundle.go new file mode 100644 index 0000000000..ae639b5ce0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-applicationversion_sourcebundle.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticBeanstalkApplicationVersion_SourceBundle AWS CloudFormation Resource (AWS::ElasticBeanstalk::ApplicationVersion.SourceBundle) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-sourcebundle.html +type AWSElasticBeanstalkApplicationVersion_SourceBundle struct { + + // S3Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-sourcebundle.html#cfn-beanstalk-sourcebundle-s3bucket + S3Bucket string `json:"S3Bucket,omitempty"` + + // S3Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-sourcebundle.html#cfn-beanstalk-sourcebundle-s3key + S3Key string `json:"S3Key,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplicationVersion_SourceBundle) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ApplicationVersion.SourceBundle" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkApplicationVersion_SourceBundle) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate.go new file mode 100644 index 0000000000..1223ca37a4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticBeanstalkConfigurationTemplate AWS CloudFormation Resource (AWS::ElasticBeanstalk::ConfigurationTemplate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html +type AWSElasticBeanstalkConfigurationTemplate struct { + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-description + Description string `json:"Description,omitempty"` + + // EnvironmentId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-environmentid + EnvironmentId string `json:"EnvironmentId,omitempty"` + + // OptionSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-optionsettings + OptionSettings []AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting `json:"OptionSettings,omitempty"` + + // SolutionStackName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-solutionstackname + SolutionStackName string `json:"SolutionStackName,omitempty"` + + // SourceConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-sourceconfiguration + SourceConfiguration *AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration `json:"SourceConfiguration,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkConfigurationTemplate) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ConfigurationTemplate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkConfigurationTemplate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticBeanstalkConfigurationTemplate) MarshalJSON() ([]byte, error) { + type Properties AWSElasticBeanstalkConfigurationTemplate + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticBeanstalkConfigurationTemplate) UnmarshalJSON(b []byte) error { + type Properties AWSElasticBeanstalkConfigurationTemplate + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticBeanstalkConfigurationTemplate(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticBeanstalkConfigurationTemplateResources retrieves all AWSElasticBeanstalkConfigurationTemplate items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticBeanstalkConfigurationTemplateResources() map[string]AWSElasticBeanstalkConfigurationTemplate { + results := map[string]AWSElasticBeanstalkConfigurationTemplate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticBeanstalkConfigurationTemplate: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticBeanstalk::ConfigurationTemplate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticBeanstalkConfigurationTemplate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticBeanstalkConfigurationTemplateWithName retrieves all AWSElasticBeanstalkConfigurationTemplate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticBeanstalkConfigurationTemplateWithName(name string) (AWSElasticBeanstalkConfigurationTemplate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticBeanstalkConfigurationTemplate: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticBeanstalk::ConfigurationTemplate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticBeanstalkConfigurationTemplate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticBeanstalkConfigurationTemplate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate_configurationoptionsetting.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate_configurationoptionsetting.go new file mode 100644 index 0000000000..3ecdc06719 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate_configurationoptionsetting.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting AWS CloudFormation Resource (AWS::ElasticBeanstalk::ConfigurationTemplate.ConfigurationOptionSetting) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html +type AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting struct { + + // Namespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html#cfn-beanstalk-optionsettings-namespace + Namespace string `json:"Namespace,omitempty"` + + // OptionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html#cfn-beanstalk-optionsettings-optionname + OptionName string `json:"OptionName,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html#cfn-beanstalk-optionsettings-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ConfigurationTemplate.ConfigurationOptionSetting" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate_sourceconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate_sourceconfiguration.go new file mode 100644 index 0000000000..f4b6a0e8b6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate_sourceconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration AWS CloudFormation Resource (AWS::ElasticBeanstalk::ConfigurationTemplate.SourceConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-configurationtemplate-sourceconfiguration.html +type AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration struct { + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-configurationtemplate-sourceconfiguration.html#cfn-beanstalk-configurationtemplate-sourceconfiguration-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` + + // TemplateName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-configurationtemplate-sourceconfiguration.html#cfn-beanstalk-configurationtemplate-sourceconfiguration-templatename + TemplateName string `json:"TemplateName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ConfigurationTemplate.SourceConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment.go new file mode 100644 index 0000000000..244979adaf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment.go @@ -0,0 +1,160 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticBeanstalkEnvironment AWS CloudFormation Resource (AWS::ElasticBeanstalk::Environment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html +type AWSElasticBeanstalkEnvironment struct { + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` + + // CNAMEPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-cnameprefix + CNAMEPrefix string `json:"CNAMEPrefix,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-description + Description string `json:"Description,omitempty"` + + // EnvironmentName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-name + EnvironmentName string `json:"EnvironmentName,omitempty"` + + // OptionSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-optionsettings + OptionSettings []AWSElasticBeanstalkEnvironment_OptionSettings `json:"OptionSettings,omitempty"` + + // SolutionStackName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-solutionstackname + SolutionStackName string `json:"SolutionStackName,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-elasticbeanstalk-environment-tags + Tags []Tag `json:"Tags,omitempty"` + + // TemplateName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-templatename + TemplateName string `json:"TemplateName,omitempty"` + + // Tier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-tier + Tier *AWSElasticBeanstalkEnvironment_Tier `json:"Tier,omitempty"` + + // VersionLabel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-versionlabel + VersionLabel string `json:"VersionLabel,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkEnvironment) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Environment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkEnvironment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticBeanstalkEnvironment) MarshalJSON() ([]byte, error) { + type Properties AWSElasticBeanstalkEnvironment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticBeanstalkEnvironment) UnmarshalJSON(b []byte) error { + type Properties AWSElasticBeanstalkEnvironment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticBeanstalkEnvironment(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticBeanstalkEnvironmentResources retrieves all AWSElasticBeanstalkEnvironment items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticBeanstalkEnvironmentResources() map[string]AWSElasticBeanstalkEnvironment { + results := map[string]AWSElasticBeanstalkEnvironment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticBeanstalkEnvironment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticBeanstalk::Environment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticBeanstalkEnvironment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticBeanstalkEnvironmentWithName retrieves all AWSElasticBeanstalkEnvironment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticBeanstalkEnvironmentWithName(name string) (AWSElasticBeanstalkEnvironment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticBeanstalkEnvironment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticBeanstalk::Environment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticBeanstalkEnvironment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticBeanstalkEnvironment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_optionsettings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_optionsettings.go new file mode 100644 index 0000000000..24f271da97 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_optionsettings.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSElasticBeanstalkEnvironment_OptionSettings AWS CloudFormation Resource (AWS::ElasticBeanstalk::Environment.OptionSettings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html +type AWSElasticBeanstalkEnvironment_OptionSettings struct { + + // Namespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html#cfn-beanstalk-optionsettings-namespace + Namespace string `json:"Namespace,omitempty"` + + // OptionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html#cfn-beanstalk-optionsettings-optionname + OptionName string `json:"OptionName,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html#cfn-beanstalk-optionsettings-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkEnvironment_OptionSettings) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Environment.OptionSettings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkEnvironment_OptionSettings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_tier.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_tier.go new file mode 100644 index 0000000000..d4d3568216 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_tier.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSElasticBeanstalkEnvironment_Tier AWS CloudFormation Resource (AWS::ElasticBeanstalk::Environment.Tier) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment-tier.html +type AWSElasticBeanstalkEnvironment_Tier struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment-tier.html#cfn-beanstalk-env-tier-name + Name string `json:"Name,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment-tier.html#cfn-beanstalk-env-tier-type + Type string `json:"Type,omitempty"` + + // Version AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment-tier.html#cfn-beanstalk-env-tier-version + Version string `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkEnvironment_Tier) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Environment.Tier" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticBeanstalkEnvironment_Tier) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer.go new file mode 100644 index 0000000000..3512638010 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer.go @@ -0,0 +1,190 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticLoadBalancingLoadBalancer AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html +type AWSElasticLoadBalancingLoadBalancer struct { + + // AccessLoggingPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-accessloggingpolicy + AccessLoggingPolicy *AWSElasticLoadBalancingLoadBalancer_AccessLoggingPolicy `json:"AccessLoggingPolicy,omitempty"` + + // AppCookieStickinessPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-appcookiestickinesspolicy + AppCookieStickinessPolicy []AWSElasticLoadBalancingLoadBalancer_AppCookieStickinessPolicy `json:"AppCookieStickinessPolicy,omitempty"` + + // AvailabilityZones AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-availabilityzones + AvailabilityZones []string `json:"AvailabilityZones,omitempty"` + + // ConnectionDrainingPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-connectiondrainingpolicy + ConnectionDrainingPolicy *AWSElasticLoadBalancingLoadBalancer_ConnectionDrainingPolicy `json:"ConnectionDrainingPolicy,omitempty"` + + // ConnectionSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-connectionsettings + ConnectionSettings *AWSElasticLoadBalancingLoadBalancer_ConnectionSettings `json:"ConnectionSettings,omitempty"` + + // CrossZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-crosszone + CrossZone bool `json:"CrossZone,omitempty"` + + // HealthCheck AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-healthcheck + HealthCheck *AWSElasticLoadBalancingLoadBalancer_HealthCheck `json:"HealthCheck,omitempty"` + + // Instances AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-instances + Instances []string `json:"Instances,omitempty"` + + // LBCookieStickinessPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-lbcookiestickinesspolicy + LBCookieStickinessPolicy []AWSElasticLoadBalancingLoadBalancer_LBCookieStickinessPolicy `json:"LBCookieStickinessPolicy,omitempty"` + + // Listeners AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-listeners + Listeners []AWSElasticLoadBalancingLoadBalancer_Listeners `json:"Listeners,omitempty"` + + // LoadBalancerName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-elbname + LoadBalancerName string `json:"LoadBalancerName,omitempty"` + + // Policies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-policies + Policies []AWSElasticLoadBalancingLoadBalancer_Policies `json:"Policies,omitempty"` + + // Scheme AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-scheme + Scheme string `json:"Scheme,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-securitygroups + SecurityGroups []string `json:"SecurityGroups,omitempty"` + + // Subnets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-subnets + Subnets []string `json:"Subnets,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-elasticloadbalancing-loadbalancer-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticLoadBalancingLoadBalancer) MarshalJSON() ([]byte, error) { + type Properties AWSElasticLoadBalancingLoadBalancer + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticLoadBalancingLoadBalancer) UnmarshalJSON(b []byte) error { + type Properties AWSElasticLoadBalancingLoadBalancer + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticLoadBalancingLoadBalancer(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticLoadBalancingLoadBalancerResources retrieves all AWSElasticLoadBalancingLoadBalancer items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticLoadBalancingLoadBalancerResources() map[string]AWSElasticLoadBalancingLoadBalancer { + results := map[string]AWSElasticLoadBalancingLoadBalancer{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingLoadBalancer: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancing::LoadBalancer" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingLoadBalancer + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticLoadBalancingLoadBalancerWithName retrieves all AWSElasticLoadBalancingLoadBalancer items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticLoadBalancingLoadBalancerWithName(name string) (AWSElasticLoadBalancingLoadBalancer, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingLoadBalancer: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancing::LoadBalancer" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingLoadBalancer + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticLoadBalancingLoadBalancer{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_accessloggingpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_accessloggingpolicy.go new file mode 100644 index 0000000000..8ff4ee926f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_accessloggingpolicy.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSElasticLoadBalancingLoadBalancer_AccessLoggingPolicy AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer.AccessLoggingPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html +type AWSElasticLoadBalancingLoadBalancer_AccessLoggingPolicy struct { + + // EmitInterval AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html#cfn-elb-accessloggingpolicy-emitinterval + EmitInterval int `json:"EmitInterval,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html#cfn-elb-accessloggingpolicy-enabled + Enabled bool `json:"Enabled,omitempty"` + + // S3BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html#cfn-elb-accessloggingpolicy-s3bucketname + S3BucketName string `json:"S3BucketName,omitempty"` + + // S3BucketPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html#cfn-elb-accessloggingpolicy-s3bucketprefix + S3BucketPrefix string `json:"S3BucketPrefix,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_AccessLoggingPolicy) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.AccessLoggingPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer_AccessLoggingPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_appcookiestickinesspolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_appcookiestickinesspolicy.go new file mode 100644 index 0000000000..616edab69f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_appcookiestickinesspolicy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingLoadBalancer_AppCookieStickinessPolicy AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer.AppCookieStickinessPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-AppCookieStickinessPolicy.html +type AWSElasticLoadBalancingLoadBalancer_AppCookieStickinessPolicy struct { + + // CookieName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-AppCookieStickinessPolicy.html#cfn-elb-appcookiestickinesspolicy-cookiename + CookieName string `json:"CookieName,omitempty"` + + // PolicyName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-AppCookieStickinessPolicy.html#cfn-elb-appcookiestickinesspolicy-policyname + PolicyName string `json:"PolicyName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_AppCookieStickinessPolicy) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.AppCookieStickinessPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer_AppCookieStickinessPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_connectiondrainingpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_connectiondrainingpolicy.go new file mode 100644 index 0000000000..e50f722c5f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_connectiondrainingpolicy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingLoadBalancer_ConnectionDrainingPolicy AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer.ConnectionDrainingPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-connectiondrainingpolicy.html +type AWSElasticLoadBalancingLoadBalancer_ConnectionDrainingPolicy struct { + + // Enabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-connectiondrainingpolicy.html#cfn-elb-connectiondrainingpolicy-enabled + Enabled bool `json:"Enabled,omitempty"` + + // Timeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-connectiondrainingpolicy.html#cfn-elb-connectiondrainingpolicy-timeout + Timeout int `json:"Timeout,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_ConnectionDrainingPolicy) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.ConnectionDrainingPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer_ConnectionDrainingPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_connectionsettings.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_connectionsettings.go new file mode 100644 index 0000000000..98bf7f02f1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_connectionsettings.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSElasticLoadBalancingLoadBalancer_ConnectionSettings AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer.ConnectionSettings) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-connectionsettings.html +type AWSElasticLoadBalancingLoadBalancer_ConnectionSettings struct { + + // IdleTimeout AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-connectionsettings.html#cfn-elb-connectionsettings-idletimeout + IdleTimeout int `json:"IdleTimeout,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_ConnectionSettings) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.ConnectionSettings" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer_ConnectionSettings) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_healthcheck.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_healthcheck.go new file mode 100644 index 0000000000..98767da7df --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_healthcheck.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSElasticLoadBalancingLoadBalancer_HealthCheck AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer.HealthCheck) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html +type AWSElasticLoadBalancingLoadBalancer_HealthCheck struct { + + // HealthyThreshold AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-healthythreshold + HealthyThreshold string `json:"HealthyThreshold,omitempty"` + + // Interval AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-interval + Interval string `json:"Interval,omitempty"` + + // Target AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-target + Target string `json:"Target,omitempty"` + + // Timeout AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-timeout + Timeout string `json:"Timeout,omitempty"` + + // UnhealthyThreshold AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-unhealthythreshold + UnhealthyThreshold string `json:"UnhealthyThreshold,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_HealthCheck) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.HealthCheck" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer_HealthCheck) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_lbcookiestickinesspolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_lbcookiestickinesspolicy.go new file mode 100644 index 0000000000..3c5fd569db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_lbcookiestickinesspolicy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingLoadBalancer_LBCookieStickinessPolicy AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer.LBCookieStickinessPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-LBCookieStickinessPolicy.html +type AWSElasticLoadBalancingLoadBalancer_LBCookieStickinessPolicy struct { + + // CookieExpirationPeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-LBCookieStickinessPolicy.html#cfn-elb-lbcookiestickinesspolicy-cookieexpirationperiod + CookieExpirationPeriod string `json:"CookieExpirationPeriod,omitempty"` + + // PolicyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-LBCookieStickinessPolicy.html#cfn-elb-lbcookiestickinesspolicy-policyname + PolicyName string `json:"PolicyName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_LBCookieStickinessPolicy) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.LBCookieStickinessPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer_LBCookieStickinessPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_listeners.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_listeners.go new file mode 100644 index 0000000000..18a06faae7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_listeners.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSElasticLoadBalancingLoadBalancer_Listeners AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer.Listeners) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html +type AWSElasticLoadBalancingLoadBalancer_Listeners struct { + + // InstancePort AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-instanceport + InstancePort string `json:"InstancePort,omitempty"` + + // InstanceProtocol AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-instanceprotocol + InstanceProtocol string `json:"InstanceProtocol,omitempty"` + + // LoadBalancerPort AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-loadbalancerport + LoadBalancerPort string `json:"LoadBalancerPort,omitempty"` + + // PolicyNames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-policynames + PolicyNames []string `json:"PolicyNames,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-protocol + Protocol string `json:"Protocol,omitempty"` + + // SSLCertificateId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-sslcertificateid + SSLCertificateId string `json:"SSLCertificateId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_Listeners) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.Listeners" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer_Listeners) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_policies.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_policies.go new file mode 100644 index 0000000000..be7c6467a3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_policies.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSElasticLoadBalancingLoadBalancer_Policies AWS CloudFormation Resource (AWS::ElasticLoadBalancing::LoadBalancer.Policies) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html +type AWSElasticLoadBalancingLoadBalancer_Policies struct { + + // Attributes AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-attributes + Attributes []interface{} `json:"Attributes,omitempty"` + + // InstancePorts AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-instanceports + InstancePorts []string `json:"InstancePorts,omitempty"` + + // LoadBalancerPorts AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-loadbalancerports + LoadBalancerPorts []string `json:"LoadBalancerPorts,omitempty"` + + // PolicyName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-policyname + PolicyName string `json:"PolicyName,omitempty"` + + // PolicyType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-policytype + PolicyType string `json:"PolicyType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_Policies) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.Policies" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingLoadBalancer_Policies) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener.go new file mode 100644 index 0000000000..5fb2290541 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticLoadBalancingV2Listener AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::Listener) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html +type AWSElasticLoadBalancingV2Listener struct { + + // Certificates AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html#cfn-elasticloadbalancingv2-listener-certificates + Certificates []AWSElasticLoadBalancingV2Listener_Certificate `json:"Certificates,omitempty"` + + // DefaultActions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html#cfn-elasticloadbalancingv2-listener-defaultactions + DefaultActions []AWSElasticLoadBalancingV2Listener_Action `json:"DefaultActions,omitempty"` + + // LoadBalancerArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html#cfn-elasticloadbalancingv2-listener-loadbalancerarn + LoadBalancerArn string `json:"LoadBalancerArn,omitempty"` + + // Port AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html#cfn-elasticloadbalancingv2-listener-port + Port int `json:"Port,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html#cfn-elasticloadbalancingv2-listener-protocol + Protocol string `json:"Protocol,omitempty"` + + // SslPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html#cfn-elasticloadbalancingv2-listener-sslpolicy + SslPolicy string `json:"SslPolicy,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2Listener) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::Listener" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2Listener) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticLoadBalancingV2Listener) MarshalJSON() ([]byte, error) { + type Properties AWSElasticLoadBalancingV2Listener + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticLoadBalancingV2Listener) UnmarshalJSON(b []byte) error { + type Properties AWSElasticLoadBalancingV2Listener + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticLoadBalancingV2Listener(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticLoadBalancingV2ListenerResources retrieves all AWSElasticLoadBalancingV2Listener items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticLoadBalancingV2ListenerResources() map[string]AWSElasticLoadBalancingV2Listener { + results := map[string]AWSElasticLoadBalancingV2Listener{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2Listener: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancingV2::Listener" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2Listener + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticLoadBalancingV2ListenerWithName retrieves all AWSElasticLoadBalancingV2Listener items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticLoadBalancingV2ListenerWithName(name string) (AWSElasticLoadBalancingV2Listener, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2Listener: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancingV2::Listener" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2Listener + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticLoadBalancingV2Listener{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener_action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener_action.go new file mode 100644 index 0000000000..c4e5430b21 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener_action.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingV2Listener_Action AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::Listener.Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listener-defaultactions.html +type AWSElasticLoadBalancingV2Listener_Action struct { + + // TargetGroupArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listener-defaultactions.html#cfn-elasticloadbalancingv2-listener-defaultactions-targetgrouparn + TargetGroupArn string `json:"TargetGroupArn,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listener-defaultactions.html#cfn-elasticloadbalancingv2-listener-defaultactions-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2Listener_Action) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::Listener.Action" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2Listener_Action) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener_certificate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener_certificate.go new file mode 100644 index 0000000000..e86fb76ac9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener_certificate.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSElasticLoadBalancingV2Listener_Certificate AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::Listener.Certificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listener-certificates.html +type AWSElasticLoadBalancingV2Listener_Certificate struct { + + // CertificateArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listener-certificates.html#cfn-elasticloadbalancingv2-listener-certificates-certificatearn + CertificateArn string `json:"CertificateArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2Listener_Certificate) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::Listener.Certificate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2Listener_Certificate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule.go new file mode 100644 index 0000000000..d14583c305 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticLoadBalancingV2ListenerRule AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::ListenerRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenerrule.html +type AWSElasticLoadBalancingV2ListenerRule struct { + + // Actions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenerrule.html#cfn-elasticloadbalancingv2-listenerrule-actions + Actions []AWSElasticLoadBalancingV2ListenerRule_Action `json:"Actions,omitempty"` + + // Conditions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenerrule.html#cfn-elasticloadbalancingv2-listenerrule-conditions + Conditions []AWSElasticLoadBalancingV2ListenerRule_RuleCondition `json:"Conditions,omitempty"` + + // ListenerArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenerrule.html#cfn-elasticloadbalancingv2-listenerrule-listenerarn + ListenerArn string `json:"ListenerArn,omitempty"` + + // Priority AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenerrule.html#cfn-elasticloadbalancingv2-listenerrule-priority + Priority int `json:"Priority,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2ListenerRule) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::ListenerRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2ListenerRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticLoadBalancingV2ListenerRule) MarshalJSON() ([]byte, error) { + type Properties AWSElasticLoadBalancingV2ListenerRule + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticLoadBalancingV2ListenerRule) UnmarshalJSON(b []byte) error { + type Properties AWSElasticLoadBalancingV2ListenerRule + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticLoadBalancingV2ListenerRule(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticLoadBalancingV2ListenerRuleResources retrieves all AWSElasticLoadBalancingV2ListenerRule items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticLoadBalancingV2ListenerRuleResources() map[string]AWSElasticLoadBalancingV2ListenerRule { + results := map[string]AWSElasticLoadBalancingV2ListenerRule{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2ListenerRule: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancingV2::ListenerRule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2ListenerRule + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticLoadBalancingV2ListenerRuleWithName retrieves all AWSElasticLoadBalancingV2ListenerRule items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticLoadBalancingV2ListenerRuleWithName(name string) (AWSElasticLoadBalancingV2ListenerRule, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2ListenerRule: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancingV2::ListenerRule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2ListenerRule + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticLoadBalancingV2ListenerRule{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule_action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule_action.go new file mode 100644 index 0000000000..6e882cf719 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule_action.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingV2ListenerRule_Action AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::ListenerRule.Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listenerrule-actions.html +type AWSElasticLoadBalancingV2ListenerRule_Action struct { + + // TargetGroupArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listenerrule-actions.html#cfn-elasticloadbalancingv2-listener-actions-targetgrouparn + TargetGroupArn string `json:"TargetGroupArn,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listenerrule-actions.html#cfn-elasticloadbalancingv2-listener-actions-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2ListenerRule_Action) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::ListenerRule.Action" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2ListenerRule_Action) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule_rulecondition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule_rulecondition.go new file mode 100644 index 0000000000..9bb4fa14f3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule_rulecondition.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingV2ListenerRule_RuleCondition AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::ListenerRule.RuleCondition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listenerrule-conditions.html +type AWSElasticLoadBalancingV2ListenerRule_RuleCondition struct { + + // Field AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listenerrule-conditions.html#cfn-elasticloadbalancingv2-listenerrule-conditions-field + Field string `json:"Field,omitempty"` + + // Values AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listenerrule-conditions.html#cfn-elasticloadbalancingv2-listenerrule-conditions-values + Values []string `json:"Values,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2ListenerRule_RuleCondition) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::ListenerRule.RuleCondition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2ListenerRule_RuleCondition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer.go new file mode 100644 index 0000000000..2ee1e39219 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticLoadBalancingV2LoadBalancer AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::LoadBalancer) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html +type AWSElasticLoadBalancingV2LoadBalancer struct { + + // IpAddressType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-ipaddresstype + IpAddressType string `json:"IpAddressType,omitempty"` + + // LoadBalancerAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-loadbalancerattributes + LoadBalancerAttributes []AWSElasticLoadBalancingV2LoadBalancer_LoadBalancerAttribute `json:"LoadBalancerAttributes,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-name + Name string `json:"Name,omitempty"` + + // Scheme AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-scheme + Scheme string `json:"Scheme,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-securitygroups + SecurityGroups []string `json:"SecurityGroups,omitempty"` + + // Subnets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-subnets + Subnets []string `json:"Subnets,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2LoadBalancer) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::LoadBalancer" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2LoadBalancer) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticLoadBalancingV2LoadBalancer) MarshalJSON() ([]byte, error) { + type Properties AWSElasticLoadBalancingV2LoadBalancer + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticLoadBalancingV2LoadBalancer) UnmarshalJSON(b []byte) error { + type Properties AWSElasticLoadBalancingV2LoadBalancer + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticLoadBalancingV2LoadBalancer(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticLoadBalancingV2LoadBalancerResources retrieves all AWSElasticLoadBalancingV2LoadBalancer items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticLoadBalancingV2LoadBalancerResources() map[string]AWSElasticLoadBalancingV2LoadBalancer { + results := map[string]AWSElasticLoadBalancingV2LoadBalancer{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2LoadBalancer: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancingV2::LoadBalancer" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2LoadBalancer + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticLoadBalancingV2LoadBalancerWithName retrieves all AWSElasticLoadBalancingV2LoadBalancer items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticLoadBalancingV2LoadBalancerWithName(name string) (AWSElasticLoadBalancingV2LoadBalancer, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2LoadBalancer: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancingV2::LoadBalancer" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2LoadBalancer + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticLoadBalancingV2LoadBalancer{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer_loadbalancerattribute.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer_loadbalancerattribute.go new file mode 100644 index 0000000000..7bb5c2844b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer_loadbalancerattribute.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingV2LoadBalancer_LoadBalancerAttribute AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::LoadBalancer.LoadBalancerAttribute) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-loadbalancerattributes.html +type AWSElasticLoadBalancingV2LoadBalancer_LoadBalancerAttribute struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-loadbalancerattributes.html#cfn-elasticloadbalancingv2-loadbalancer-loadbalancerattributes-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-loadbalancerattributes.html#cfn-elasticloadbalancingv2-loadbalancer-loadbalancerattributes-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2LoadBalancer_LoadBalancerAttribute) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::LoadBalancer.LoadBalancerAttribute" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2LoadBalancer_LoadBalancerAttribute) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup.go new file mode 100644 index 0000000000..1fa491359a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup.go @@ -0,0 +1,185 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticLoadBalancingV2TargetGroup AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::TargetGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html +type AWSElasticLoadBalancingV2TargetGroup struct { + + // HealthCheckIntervalSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-healthcheckintervalseconds + HealthCheckIntervalSeconds int `json:"HealthCheckIntervalSeconds,omitempty"` + + // HealthCheckPath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-healthcheckpath + HealthCheckPath string `json:"HealthCheckPath,omitempty"` + + // HealthCheckPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-healthcheckport + HealthCheckPort string `json:"HealthCheckPort,omitempty"` + + // HealthCheckProtocol AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-healthcheckprotocol + HealthCheckProtocol string `json:"HealthCheckProtocol,omitempty"` + + // HealthCheckTimeoutSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-healthchecktimeoutseconds + HealthCheckTimeoutSeconds int `json:"HealthCheckTimeoutSeconds,omitempty"` + + // HealthyThresholdCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-healthythresholdcount + HealthyThresholdCount int `json:"HealthyThresholdCount,omitempty"` + + // Matcher AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-matcher + Matcher *AWSElasticLoadBalancingV2TargetGroup_Matcher `json:"Matcher,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-name + Name string `json:"Name,omitempty"` + + // Port AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-port + Port int `json:"Port,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-protocol + Protocol string `json:"Protocol,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-tags + Tags []Tag `json:"Tags,omitempty"` + + // TargetGroupAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-targetgroupattributes + TargetGroupAttributes []AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute `json:"TargetGroupAttributes,omitempty"` + + // Targets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-targets + Targets []AWSElasticLoadBalancingV2TargetGroup_TargetDescription `json:"Targets,omitempty"` + + // UnhealthyThresholdCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-unhealthythresholdcount + UnhealthyThresholdCount int `json:"UnhealthyThresholdCount,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2TargetGroup) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::TargetGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2TargetGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticLoadBalancingV2TargetGroup) MarshalJSON() ([]byte, error) { + type Properties AWSElasticLoadBalancingV2TargetGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticLoadBalancingV2TargetGroup) UnmarshalJSON(b []byte) error { + type Properties AWSElasticLoadBalancingV2TargetGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticLoadBalancingV2TargetGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticLoadBalancingV2TargetGroupResources retrieves all AWSElasticLoadBalancingV2TargetGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticLoadBalancingV2TargetGroupResources() map[string]AWSElasticLoadBalancingV2TargetGroup { + results := map[string]AWSElasticLoadBalancingV2TargetGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2TargetGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancingV2::TargetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2TargetGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticLoadBalancingV2TargetGroupWithName retrieves all AWSElasticLoadBalancingV2TargetGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticLoadBalancingV2TargetGroupWithName(name string) (AWSElasticLoadBalancingV2TargetGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2TargetGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::ElasticLoadBalancingV2::TargetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2TargetGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticLoadBalancingV2TargetGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_matcher.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_matcher.go new file mode 100644 index 0000000000..a449f31e7f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_matcher.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSElasticLoadBalancingV2TargetGroup_Matcher AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::TargetGroup.Matcher) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-matcher.html +type AWSElasticLoadBalancingV2TargetGroup_Matcher struct { + + // HttpCode AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-matcher.html#cfn-elasticloadbalancingv2-targetgroup-matcher-httpcode + HttpCode string `json:"HttpCode,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2TargetGroup_Matcher) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::TargetGroup.Matcher" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2TargetGroup_Matcher) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_targetdescription.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_targetdescription.go new file mode 100644 index 0000000000..b2038a12f1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_targetdescription.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingV2TargetGroup_TargetDescription AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescription) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetdescription.html +type AWSElasticLoadBalancingV2TargetGroup_TargetDescription struct { + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetdescription.html#cfn-elasticloadbalancingv2-targetgroup-targetdescription-id + Id string `json:"Id,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetdescription.html#cfn-elasticloadbalancingv2-targetgroup-targetdescription-port + Port int `json:"Port,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2TargetGroup_TargetDescription) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescription" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2TargetGroup_TargetDescription) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_targetgroupattribute.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_targetgroupattribute.go new file mode 100644 index 0000000000..5604147df3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_targetgroupattribute.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::TargetGroup.TargetGroupAttribute) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetgroupattributes.html +type AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetgroupattributes.html#cfn-elasticloadbalancingv2-targetgroup-targetgroupattributes-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetgroupattributes.html#cfn-elasticloadbalancingv2-targetgroup-targetgroupattributes-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::TargetGroup.TargetGroupAttribute" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain.go new file mode 100644 index 0000000000..25106ed2d8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain.go @@ -0,0 +1,150 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticsearchDomain AWS CloudFormation Resource (AWS::Elasticsearch::Domain) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html +type AWSElasticsearchDomain struct { + + // AccessPolicies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-accesspolicies + AccessPolicies interface{} `json:"AccessPolicies,omitempty"` + + // AdvancedOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-advancedoptions + AdvancedOptions map[string]string `json:"AdvancedOptions,omitempty"` + + // DomainName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-domainname + DomainName string `json:"DomainName,omitempty"` + + // EBSOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-ebsoptions + EBSOptions *AWSElasticsearchDomain_EBSOptions `json:"EBSOptions,omitempty"` + + // ElasticsearchClusterConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-elasticsearchclusterconfig + ElasticsearchClusterConfig *AWSElasticsearchDomain_ElasticsearchClusterConfig `json:"ElasticsearchClusterConfig,omitempty"` + + // ElasticsearchVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-elasticsearchversion + ElasticsearchVersion string `json:"ElasticsearchVersion,omitempty"` + + // SnapshotOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-snapshotoptions + SnapshotOptions *AWSElasticsearchDomain_SnapshotOptions `json:"SnapshotOptions,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticsearchDomain) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSElasticsearchDomain) MarshalJSON() ([]byte, error) { + type Properties AWSElasticsearchDomain + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticsearchDomain) UnmarshalJSON(b []byte) error { + type Properties AWSElasticsearchDomain + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSElasticsearchDomain(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticsearchDomainResources retrieves all AWSElasticsearchDomain items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticsearchDomainResources() map[string]AWSElasticsearchDomain { + results := map[string]AWSElasticsearchDomain{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticsearchDomain: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Elasticsearch::Domain" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticsearchDomain + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticsearchDomainWithName retrieves all AWSElasticsearchDomain items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticsearchDomainWithName(name string) (AWSElasticsearchDomain, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticsearchDomain: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Elasticsearch::Domain" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticsearchDomain + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticsearchDomain{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_ebsoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_ebsoptions.go new file mode 100644 index 0000000000..423f808565 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_ebsoptions.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSElasticsearchDomain_EBSOptions AWS CloudFormation Resource (AWS::Elasticsearch::Domain.EBSOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-ebsoptions.html +type AWSElasticsearchDomain_EBSOptions struct { + + // EBSEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-ebsoptions.html#cfn-elasticsearch-domain-ebsoptions-ebsenabled + EBSEnabled bool `json:"EBSEnabled,omitempty"` + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-ebsoptions.html#cfn-elasticsearch-domain-ebsoptions-iops + Iops int `json:"Iops,omitempty"` + + // VolumeSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-ebsoptions.html#cfn-elasticsearch-domain-ebsoptions-volumesize + VolumeSize int `json:"VolumeSize,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-ebsoptions.html#cfn-elasticsearch-domain-ebsoptions-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain_EBSOptions) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain.EBSOptions" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticsearchDomain_EBSOptions) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_elasticsearchclusterconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_elasticsearchclusterconfig.go new file mode 100644 index 0000000000..4196fde89a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_elasticsearchclusterconfig.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSElasticsearchDomain_ElasticsearchClusterConfig AWS CloudFormation Resource (AWS::Elasticsearch::Domain.ElasticsearchClusterConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html +type AWSElasticsearchDomain_ElasticsearchClusterConfig struct { + + // DedicatedMasterCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html#cfn-elasticsearch-domain-elasticseachclusterconfig-dedicatedmastercount + DedicatedMasterCount int `json:"DedicatedMasterCount,omitempty"` + + // DedicatedMasterEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html#cfn-elasticsearch-domain-elasticseachclusterconfig-dedicatedmasterenabled + DedicatedMasterEnabled bool `json:"DedicatedMasterEnabled,omitempty"` + + // DedicatedMasterType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html#cfn-elasticsearch-domain-elasticseachclusterconfig-dedicatedmastertype + DedicatedMasterType string `json:"DedicatedMasterType,omitempty"` + + // InstanceCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html#cfn-elasticsearch-domain-elasticseachclusterconfig-instancecount + InstanceCount int `json:"InstanceCount,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html#cfn-elasticsearch-domain-elasticseachclusterconfig-instnacetype + InstanceType string `json:"InstanceType,omitempty"` + + // ZoneAwarenessEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html#cfn-elasticsearch-domain-elasticseachclusterconfig-zoneawarenessenabled + ZoneAwarenessEnabled bool `json:"ZoneAwarenessEnabled,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain_ElasticsearchClusterConfig) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain.ElasticsearchClusterConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticsearchDomain_ElasticsearchClusterConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_snapshotoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_snapshotoptions.go new file mode 100644 index 0000000000..88ff6f9916 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_snapshotoptions.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSElasticsearchDomain_SnapshotOptions AWS CloudFormation Resource (AWS::Elasticsearch::Domain.SnapshotOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-snapshotoptions.html +type AWSElasticsearchDomain_SnapshotOptions struct { + + // AutomatedSnapshotStartHour AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-snapshotoptions.html#cfn-elasticsearch-domain-snapshotoptions-automatedsnapshotstarthour + AutomatedSnapshotStartHour int `json:"AutomatedSnapshotStartHour,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain_SnapshotOptions) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain.SnapshotOptions" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSElasticsearchDomain_SnapshotOptions) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster.go new file mode 100644 index 0000000000..56eb35fd93 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster.go @@ -0,0 +1,185 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEMRCluster AWS CloudFormation Resource (AWS::EMR::Cluster) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html +type AWSEMRCluster struct { + + // AdditionalInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-additionalinfo + AdditionalInfo interface{} `json:"AdditionalInfo,omitempty"` + + // Applications AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-applications + Applications []AWSEMRCluster_Application `json:"Applications,omitempty"` + + // AutoScalingRole AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-elasticmapreduce-cluster-autoscalingrole + AutoScalingRole string `json:"AutoScalingRole,omitempty"` + + // BootstrapActions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-bootstrapactions + BootstrapActions []AWSEMRCluster_BootstrapActionConfig `json:"BootstrapActions,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-configurations + Configurations []AWSEMRCluster_Configuration `json:"Configurations,omitempty"` + + // Instances AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-instances + Instances *AWSEMRCluster_JobFlowInstancesConfig `json:"Instances,omitempty"` + + // JobFlowRole AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-jobflowrole + JobFlowRole string `json:"JobFlowRole,omitempty"` + + // LogUri AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-loguri + LogUri string `json:"LogUri,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-name + Name string `json:"Name,omitempty"` + + // ReleaseLabel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-releaselabel + ReleaseLabel string `json:"ReleaseLabel,omitempty"` + + // ScaleDownBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-elasticmapreduce-cluster-scaledownbehavior + ScaleDownBehavior string `json:"ScaleDownBehavior,omitempty"` + + // SecurityConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-securityconfiguration + SecurityConfiguration string `json:"SecurityConfiguration,omitempty"` + + // ServiceRole AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-servicerole + ServiceRole string `json:"ServiceRole,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-elasticmapreduce-cluster-tags + Tags []Tag `json:"Tags,omitempty"` + + // VisibleToAllUsers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-visibletoallusers + VisibleToAllUsers bool `json:"VisibleToAllUsers,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster) AWSCloudFormationType() string { + return "AWS::EMR::Cluster" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEMRCluster) MarshalJSON() ([]byte, error) { + type Properties AWSEMRCluster + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEMRCluster) UnmarshalJSON(b []byte) error { + type Properties AWSEMRCluster + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEMRCluster(*res.Properties) + } + + return nil +} + +// GetAllAWSEMRClusterResources retrieves all AWSEMRCluster items from an AWS CloudFormation template +func (t *Template) GetAllAWSEMRClusterResources() map[string]AWSEMRCluster { + results := map[string]AWSEMRCluster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEMRCluster: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRCluster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEMRClusterWithName retrieves all AWSEMRCluster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEMRClusterWithName(name string) (AWSEMRCluster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEMRCluster: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRCluster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEMRCluster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_application.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_application.go new file mode 100644 index 0000000000..289aa1dfcd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_application.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSEMRCluster_Application AWS CloudFormation Resource (AWS::EMR::Cluster.Application) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-application.html +type AWSEMRCluster_Application struct { + + // AdditionalInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-application.html#cfn-emr-cluster-application-additionalinfo + AdditionalInfo map[string]string `json:"AdditionalInfo,omitempty"` + + // Args AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-application.html#cfn-emr-cluster-application-args + Args []string `json:"Args,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-application.html#cfn-emr-cluster-application-name + Name string `json:"Name,omitempty"` + + // Version AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-application.html#cfn-emr-cluster-application-version + Version string `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_Application) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.Application" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_Application) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_autoscalingpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_autoscalingpolicy.go new file mode 100644 index 0000000000..cb04c5dd31 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_autoscalingpolicy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRCluster_AutoScalingPolicy AWS CloudFormation Resource (AWS::EMR::Cluster.AutoScalingPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-autoscalingpolicy.html +type AWSEMRCluster_AutoScalingPolicy struct { + + // Constraints AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-autoscalingpolicy.html#cfn-elasticmapreduce-cluster-autoscalingpolicy-constraints + Constraints *AWSEMRCluster_ScalingConstraints `json:"Constraints,omitempty"` + + // Rules AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-autoscalingpolicy.html#cfn-elasticmapreduce-cluster-autoscalingpolicy-rules + Rules []AWSEMRCluster_ScalingRule `json:"Rules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_AutoScalingPolicy) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.AutoScalingPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_AutoScalingPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_bootstrapactionconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_bootstrapactionconfig.go new file mode 100644 index 0000000000..d907f64d68 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_bootstrapactionconfig.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRCluster_BootstrapActionConfig AWS CloudFormation Resource (AWS::EMR::Cluster.BootstrapActionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-bootstrapactionconfig.html +type AWSEMRCluster_BootstrapActionConfig struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-bootstrapactionconfig.html#cfn-emr-cluster-bootstrapactionconfig-name + Name string `json:"Name,omitempty"` + + // ScriptBootstrapAction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-bootstrapactionconfig.html#cfn-emr-cluster-bootstrapactionconfig-scriptbootstrapaction + ScriptBootstrapAction *AWSEMRCluster_ScriptBootstrapActionConfig `json:"ScriptBootstrapAction,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_BootstrapActionConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.BootstrapActionConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_BootstrapActionConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_cloudwatchalarmdefinition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_cloudwatchalarmdefinition.go new file mode 100644 index 0000000000..31486d44b7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_cloudwatchalarmdefinition.go @@ -0,0 +1,61 @@ +package cloudformation + +// AWSEMRCluster_CloudWatchAlarmDefinition AWS CloudFormation Resource (AWS::EMR::Cluster.CloudWatchAlarmDefinition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html +type AWSEMRCluster_CloudWatchAlarmDefinition struct { + + // ComparisonOperator AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-comparisonoperator + ComparisonOperator string `json:"ComparisonOperator,omitempty"` + + // Dimensions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-dimensions + Dimensions []AWSEMRCluster_MetricDimension `json:"Dimensions,omitempty"` + + // EvaluationPeriods AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-evaluationperiods + EvaluationPeriods int `json:"EvaluationPeriods,omitempty"` + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-metricname + MetricName string `json:"MetricName,omitempty"` + + // Namespace AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-namespace + Namespace string `json:"Namespace,omitempty"` + + // Period AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-period + Period int `json:"Period,omitempty"` + + // Statistic AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-statistic + Statistic string `json:"Statistic,omitempty"` + + // Threshold AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-threshold + Threshold float64 `json:"Threshold,omitempty"` + + // Unit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-cluster-cloudwatchalarmdefinition-unit + Unit string `json:"Unit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_CloudWatchAlarmDefinition) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.CloudWatchAlarmDefinition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_CloudWatchAlarmDefinition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_configuration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_configuration.go new file mode 100644 index 0000000000..3bf978dc06 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_configuration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRCluster_Configuration AWS CloudFormation Resource (AWS::EMR::Cluster.Configuration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html +type AWSEMRCluster_Configuration struct { + + // Classification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html#cfn-emr-cluster-configuration-classification + Classification string `json:"Classification,omitempty"` + + // ConfigurationProperties AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html#cfn-emr-cluster-configuration-configurationproperties + ConfigurationProperties map[string]string `json:"ConfigurationProperties,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html#cfn-emr-cluster-configuration-configurations + Configurations []AWSEMRCluster_Configuration `json:"Configurations,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_Configuration) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.Configuration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_Configuration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_ebsblockdeviceconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_ebsblockdeviceconfig.go new file mode 100644 index 0000000000..98925734e5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_ebsblockdeviceconfig.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRCluster_EbsBlockDeviceConfig AWS CloudFormation Resource (AWS::EMR::Cluster.EbsBlockDeviceConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig.html +type AWSEMRCluster_EbsBlockDeviceConfig struct { + + // VolumeSpecification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification + VolumeSpecification *AWSEMRCluster_VolumeSpecification `json:"VolumeSpecification,omitempty"` + + // VolumesPerInstance AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumesperinstance + VolumesPerInstance int `json:"VolumesPerInstance,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_EbsBlockDeviceConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.EbsBlockDeviceConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_EbsBlockDeviceConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_ebsconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_ebsconfiguration.go new file mode 100644 index 0000000000..3ae39878bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_ebsconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRCluster_EbsConfiguration AWS CloudFormation Resource (AWS::EMR::Cluster.EbsConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration.html +type AWSEMRCluster_EbsConfiguration struct { + + // EbsBlockDeviceConfigs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfigs + EbsBlockDeviceConfigs []AWSEMRCluster_EbsBlockDeviceConfig `json:"EbsBlockDeviceConfigs,omitempty"` + + // EbsOptimized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration.html#cfn-emr-ebsconfiguration-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_EbsConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.EbsConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_EbsConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancefleetconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancefleetconfig.go new file mode 100644 index 0000000000..83708c6b8f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancefleetconfig.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSEMRCluster_InstanceFleetConfig AWS CloudFormation Resource (AWS::EMR::Cluster.InstanceFleetConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancefleetconfig.html +type AWSEMRCluster_InstanceFleetConfig struct { + + // InstanceTypeConfigs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancefleetconfig.html#cfn-elasticmapreduce-cluster-instancefleetconfig-instancetypeconfigs + InstanceTypeConfigs []AWSEMRCluster_InstanceTypeConfig `json:"InstanceTypeConfigs,omitempty"` + + // LaunchSpecifications AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancefleetconfig.html#cfn-elasticmapreduce-cluster-instancefleetconfig-launchspecifications + LaunchSpecifications *AWSEMRCluster_InstanceFleetProvisioningSpecifications `json:"LaunchSpecifications,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancefleetconfig.html#cfn-elasticmapreduce-cluster-instancefleetconfig-name + Name string `json:"Name,omitempty"` + + // TargetOnDemandCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancefleetconfig.html#cfn-elasticmapreduce-cluster-instancefleetconfig-targetondemandcapacity + TargetOnDemandCapacity int `json:"TargetOnDemandCapacity,omitempty"` + + // TargetSpotCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancefleetconfig.html#cfn-elasticmapreduce-cluster-instancefleetconfig-targetspotcapacity + TargetSpotCapacity int `json:"TargetSpotCapacity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_InstanceFleetConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.InstanceFleetConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_InstanceFleetConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancefleetprovisioningspecifications.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancefleetprovisioningspecifications.go new file mode 100644 index 0000000000..2861bf2eca --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancefleetprovisioningspecifications.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEMRCluster_InstanceFleetProvisioningSpecifications AWS CloudFormation Resource (AWS::EMR::Cluster.InstanceFleetProvisioningSpecifications) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancefleetprovisioningspecifications.html +type AWSEMRCluster_InstanceFleetProvisioningSpecifications struct { + + // SpotSpecification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancefleetprovisioningspecifications.html#cfn-elasticmapreduce-cluster-instancefleetprovisioningspecifications-spotspecification + SpotSpecification *AWSEMRCluster_SpotProvisioningSpecification `json:"SpotSpecification,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_InstanceFleetProvisioningSpecifications) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.InstanceFleetProvisioningSpecifications" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_InstanceFleetProvisioningSpecifications) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancegroupconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancegroupconfig.go new file mode 100644 index 0000000000..7a99e91138 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancegroupconfig.go @@ -0,0 +1,56 @@ +package cloudformation + +// AWSEMRCluster_InstanceGroupConfig AWS CloudFormation Resource (AWS::EMR::Cluster.InstanceGroupConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html +type AWSEMRCluster_InstanceGroupConfig struct { + + // AutoScalingPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html#cfn-elasticmapreduce-cluster-instancegroupconfig-autoscalingpolicy + AutoScalingPolicy *AWSEMRCluster_AutoScalingPolicy `json:"AutoScalingPolicy,omitempty"` + + // BidPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html#cfn-emr-cluster-jobflowinstancesconfig-instancegroupconfig-bidprice + BidPrice string `json:"BidPrice,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html#cfn-emr-cluster-jobflowinstancesconfig-instancegroupconfig-configurations + Configurations []AWSEMRCluster_Configuration `json:"Configurations,omitempty"` + + // EbsConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html#cfn-emr-cluster-jobflowinstancesconfig-instancegroupconfigConfigurations-ebsconfiguration + EbsConfiguration *AWSEMRCluster_EbsConfiguration `json:"EbsConfiguration,omitempty"` + + // InstanceCount AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html#cfn-emr-cluster-jobflowinstancesconfig-instancegroupconfig-instancecount + InstanceCount int `json:"InstanceCount,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html#cfn-emr-cluster-jobflowinstancesconfig-instancegroupconfig-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // Market AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html#cfn-emr-cluster-jobflowinstancesconfig-instancegroupconfig-market + Market string `json:"Market,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-instancegroupconfig.html#cfn-emr-cluster-jobflowinstancesconfig-instancegroupconfig-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_InstanceGroupConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.InstanceGroupConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_InstanceGroupConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancetypeconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancetypeconfig.go new file mode 100644 index 0000000000..c42227f020 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancetypeconfig.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSEMRCluster_InstanceTypeConfig AWS CloudFormation Resource (AWS::EMR::Cluster.InstanceTypeConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancetypeconfig.html +type AWSEMRCluster_InstanceTypeConfig struct { + + // BidPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancetypeconfig.html#cfn-elasticmapreduce-cluster-instancetypeconfig-bidprice + BidPrice string `json:"BidPrice,omitempty"` + + // BidPriceAsPercentageOfOnDemandPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancetypeconfig.html#cfn-elasticmapreduce-cluster-instancetypeconfig-bidpriceaspercentageofondemandprice + BidPriceAsPercentageOfOnDemandPrice float64 `json:"BidPriceAsPercentageOfOnDemandPrice,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancetypeconfig.html#cfn-elasticmapreduce-cluster-instancetypeconfig-configurations + Configurations []AWSEMRCluster_Configuration `json:"Configurations,omitempty"` + + // EbsConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancetypeconfig.html#cfn-elasticmapreduce-cluster-instancetypeconfig-ebsconfiguration + EbsConfiguration *AWSEMRCluster_EbsConfiguration `json:"EbsConfiguration,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancetypeconfig.html#cfn-elasticmapreduce-cluster-instancetypeconfig-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // WeightedCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancetypeconfig.html#cfn-elasticmapreduce-cluster-instancetypeconfig-weightedcapacity + WeightedCapacity int `json:"WeightedCapacity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_InstanceTypeConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.InstanceTypeConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_InstanceTypeConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_jobflowinstancesconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_jobflowinstancesconfig.go new file mode 100644 index 0000000000..4a07acf7c7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_jobflowinstancesconfig.go @@ -0,0 +1,86 @@ +package cloudformation + +// AWSEMRCluster_JobFlowInstancesConfig AWS CloudFormation Resource (AWS::EMR::Cluster.JobFlowInstancesConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html +type AWSEMRCluster_JobFlowInstancesConfig struct { + + // AdditionalMasterSecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-additionalmastersecuritygroups + AdditionalMasterSecurityGroups []string `json:"AdditionalMasterSecurityGroups,omitempty"` + + // AdditionalSlaveSecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-additionalslavesecuritygroups + AdditionalSlaveSecurityGroups []string `json:"AdditionalSlaveSecurityGroups,omitempty"` + + // CoreInstanceFleet AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-cluster-jobflowinstancesconfig-coreinstancefleet + CoreInstanceFleet *AWSEMRCluster_InstanceFleetConfig `json:"CoreInstanceFleet,omitempty"` + + // CoreInstanceGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-coreinstancegroup + CoreInstanceGroup *AWSEMRCluster_InstanceGroupConfig `json:"CoreInstanceGroup,omitempty"` + + // Ec2KeyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-ec2keyname + Ec2KeyName string `json:"Ec2KeyName,omitempty"` + + // Ec2SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-ec2subnetid + Ec2SubnetId string `json:"Ec2SubnetId,omitempty"` + + // EmrManagedMasterSecurityGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-emrmanagedmastersecuritygroup + EmrManagedMasterSecurityGroup string `json:"EmrManagedMasterSecurityGroup,omitempty"` + + // EmrManagedSlaveSecurityGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-emrmanagedslavesecuritygroup + EmrManagedSlaveSecurityGroup string `json:"EmrManagedSlaveSecurityGroup,omitempty"` + + // HadoopVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-hadoopversion + HadoopVersion string `json:"HadoopVersion,omitempty"` + + // MasterInstanceFleet AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-cluster-jobflowinstancesconfig-masterinstancefleet + MasterInstanceFleet *AWSEMRCluster_InstanceFleetConfig `json:"MasterInstanceFleet,omitempty"` + + // MasterInstanceGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-coreinstancegroup + MasterInstanceGroup *AWSEMRCluster_InstanceGroupConfig `json:"MasterInstanceGroup,omitempty"` + + // Placement AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-placement + Placement *AWSEMRCluster_PlacementType `json:"Placement,omitempty"` + + // ServiceAccessSecurityGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-serviceaccesssecuritygroup + ServiceAccessSecurityGroup string `json:"ServiceAccessSecurityGroup,omitempty"` + + // TerminationProtected AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig.html#cfn-emr-cluster-jobflowinstancesconfig-terminationprotected + TerminationProtected bool `json:"TerminationProtected,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_JobFlowInstancesConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.JobFlowInstancesConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_JobFlowInstancesConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_metricdimension.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_metricdimension.go new file mode 100644 index 0000000000..2f09f780b6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_metricdimension.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRCluster_MetricDimension AWS CloudFormation Resource (AWS::EMR::Cluster.MetricDimension) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-metricdimension.html +type AWSEMRCluster_MetricDimension struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-metricdimension.html#cfn-elasticmapreduce-cluster-metricdimension-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-metricdimension.html#cfn-elasticmapreduce-cluster-metricdimension-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_MetricDimension) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.MetricDimension" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_MetricDimension) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_placementtype.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_placementtype.go new file mode 100644 index 0000000000..d0175bb05d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_placementtype.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEMRCluster_PlacementType AWS CloudFormation Resource (AWS::EMR::Cluster.PlacementType) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-placementtype.html +type AWSEMRCluster_PlacementType struct { + + // AvailabilityZone AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-placementtype.html#aws-properties-emr-cluster-jobflowinstancesconfig-placementtype + AvailabilityZone string `json:"AvailabilityZone,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_PlacementType) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.PlacementType" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_PlacementType) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingaction.go new file mode 100644 index 0000000000..61d1176f07 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingaction.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRCluster_ScalingAction AWS CloudFormation Resource (AWS::EMR::Cluster.ScalingAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingaction.html +type AWSEMRCluster_ScalingAction struct { + + // Market AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingaction.html#cfn-elasticmapreduce-cluster-scalingaction-market + Market string `json:"Market,omitempty"` + + // SimpleScalingPolicyConfiguration AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingaction.html#cfn-elasticmapreduce-cluster-scalingaction-simplescalingpolicyconfiguration + SimpleScalingPolicyConfiguration *AWSEMRCluster_SimpleScalingPolicyConfiguration `json:"SimpleScalingPolicyConfiguration,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScalingAction) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScalingAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_ScalingAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingconstraints.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingconstraints.go new file mode 100644 index 0000000000..16f814d0d3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingconstraints.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRCluster_ScalingConstraints AWS CloudFormation Resource (AWS::EMR::Cluster.ScalingConstraints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingconstraints.html +type AWSEMRCluster_ScalingConstraints struct { + + // MaxCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingconstraints.html#cfn-elasticmapreduce-cluster-scalingconstraints-maxcapacity + MaxCapacity int `json:"MaxCapacity,omitempty"` + + // MinCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingconstraints.html#cfn-elasticmapreduce-cluster-scalingconstraints-mincapacity + MinCapacity int `json:"MinCapacity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScalingConstraints) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScalingConstraints" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_ScalingConstraints) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingrule.go new file mode 100644 index 0000000000..1aee4bbd18 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingrule.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSEMRCluster_ScalingRule AWS CloudFormation Resource (AWS::EMR::Cluster.ScalingRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingrule.html +type AWSEMRCluster_ScalingRule struct { + + // Action AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingrule.html#cfn-elasticmapreduce-cluster-scalingrule-action + Action *AWSEMRCluster_ScalingAction `json:"Action,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingrule.html#cfn-elasticmapreduce-cluster-scalingrule-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingrule.html#cfn-elasticmapreduce-cluster-scalingrule-name + Name string `json:"Name,omitempty"` + + // Trigger AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingrule.html#cfn-elasticmapreduce-cluster-scalingrule-trigger + Trigger *AWSEMRCluster_ScalingTrigger `json:"Trigger,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScalingRule) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScalingRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_ScalingRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingtrigger.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingtrigger.go new file mode 100644 index 0000000000..e9fc0b52d0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingtrigger.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEMRCluster_ScalingTrigger AWS CloudFormation Resource (AWS::EMR::Cluster.ScalingTrigger) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingtrigger.html +type AWSEMRCluster_ScalingTrigger struct { + + // CloudWatchAlarmDefinition AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scalingtrigger.html#cfn-elasticmapreduce-cluster-scalingtrigger-cloudwatchalarmdefinition + CloudWatchAlarmDefinition *AWSEMRCluster_CloudWatchAlarmDefinition `json:"CloudWatchAlarmDefinition,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScalingTrigger) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScalingTrigger" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_ScalingTrigger) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scriptbootstrapactionconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scriptbootstrapactionconfig.go new file mode 100644 index 0000000000..0b8663774f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scriptbootstrapactionconfig.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRCluster_ScriptBootstrapActionConfig AWS CloudFormation Resource (AWS::EMR::Cluster.ScriptBootstrapActionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-bootstrapactionconfig-scriptbootstrapactionconfig.html +type AWSEMRCluster_ScriptBootstrapActionConfig struct { + + // Args AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-bootstrapactionconfig-scriptbootstrapactionconfig.html#cfn-emr-cluster-bootstrapactionconfig-scriptbootstrapaction-args + Args []string `json:"Args,omitempty"` + + // Path AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-bootstrapactionconfig-scriptbootstrapactionconfig.html#cfn-emr-cluster-bootstrapactionconfig-scriptbootstrapaction-path + Path string `json:"Path,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScriptBootstrapActionConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScriptBootstrapActionConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_ScriptBootstrapActionConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_simplescalingpolicyconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_simplescalingpolicyconfiguration.go new file mode 100644 index 0000000000..8808044a89 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_simplescalingpolicyconfiguration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRCluster_SimpleScalingPolicyConfiguration AWS CloudFormation Resource (AWS::EMR::Cluster.SimpleScalingPolicyConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-simplescalingpolicyconfiguration.html +type AWSEMRCluster_SimpleScalingPolicyConfiguration struct { + + // AdjustmentType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-simplescalingpolicyconfiguration.html#cfn-elasticmapreduce-cluster-simplescalingpolicyconfiguration-adjustmenttype + AdjustmentType string `json:"AdjustmentType,omitempty"` + + // CoolDown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-simplescalingpolicyconfiguration.html#cfn-elasticmapreduce-cluster-simplescalingpolicyconfiguration-cooldown + CoolDown int `json:"CoolDown,omitempty"` + + // ScalingAdjustment AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-simplescalingpolicyconfiguration.html#cfn-elasticmapreduce-cluster-simplescalingpolicyconfiguration-scalingadjustment + ScalingAdjustment int `json:"ScalingAdjustment,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_SimpleScalingPolicyConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.SimpleScalingPolicyConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_SimpleScalingPolicyConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_spotprovisioningspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_spotprovisioningspecification.go new file mode 100644 index 0000000000..62402bfd6f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_spotprovisioningspecification.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRCluster_SpotProvisioningSpecification AWS CloudFormation Resource (AWS::EMR::Cluster.SpotProvisioningSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-spotprovisioningspecification.html +type AWSEMRCluster_SpotProvisioningSpecification struct { + + // BlockDurationMinutes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-spotprovisioningspecification.html#cfn-elasticmapreduce-cluster-spotprovisioningspecification-blockdurationminutes + BlockDurationMinutes int `json:"BlockDurationMinutes,omitempty"` + + // TimeoutAction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-spotprovisioningspecification.html#cfn-elasticmapreduce-cluster-spotprovisioningspecification-timeoutaction + TimeoutAction string `json:"TimeoutAction,omitempty"` + + // TimeoutDurationMinutes AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-spotprovisioningspecification.html#cfn-elasticmapreduce-cluster-spotprovisioningspecification-timeoutdurationminutes + TimeoutDurationMinutes int `json:"TimeoutDurationMinutes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_SpotProvisioningSpecification) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.SpotProvisioningSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_SpotProvisioningSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_volumespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_volumespecification.go new file mode 100644 index 0000000000..6f5ff1302f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_volumespecification.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRCluster_VolumeSpecification AWS CloudFormation Resource (AWS::EMR::Cluster.VolumeSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification.html +type AWSEMRCluster_VolumeSpecification struct { + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification-iops + Iops int `json:"Iops,omitempty"` + + // SizeInGB AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification-sizeingb + SizeInGB int `json:"SizeInGB,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_VolumeSpecification) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.VolumeSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRCluster_VolumeSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig.go new file mode 100644 index 0000000000..c5913d1167 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEMRInstanceFleetConfig AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-instancefleetconfig.html +type AWSEMRInstanceFleetConfig struct { + + // ClusterId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-instancefleetconfig.html#cfn-elasticmapreduce-instancefleetconfig-clusterid + ClusterId string `json:"ClusterId,omitempty"` + + // InstanceFleetType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-instancefleetconfig.html#cfn-elasticmapreduce-instancefleetconfig-instancefleettype + InstanceFleetType string `json:"InstanceFleetType,omitempty"` + + // InstanceTypeConfigs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-instancefleetconfig.html#cfn-elasticmapreduce-instancefleetconfig-instancetypeconfigs + InstanceTypeConfigs []AWSEMRInstanceFleetConfig_InstanceTypeConfig `json:"InstanceTypeConfigs,omitempty"` + + // LaunchSpecifications AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-instancefleetconfig.html#cfn-elasticmapreduce-instancefleetconfig-launchspecifications + LaunchSpecifications *AWSEMRInstanceFleetConfig_InstanceFleetProvisioningSpecifications `json:"LaunchSpecifications,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-instancefleetconfig.html#cfn-elasticmapreduce-instancefleetconfig-name + Name string `json:"Name,omitempty"` + + // TargetOnDemandCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-instancefleetconfig.html#cfn-elasticmapreduce-instancefleetconfig-targetondemandcapacity + TargetOnDemandCapacity int `json:"TargetOnDemandCapacity,omitempty"` + + // TargetSpotCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-instancefleetconfig.html#cfn-elasticmapreduce-instancefleetconfig-targetspotcapacity + TargetSpotCapacity int `json:"TargetSpotCapacity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceFleetConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEMRInstanceFleetConfig) MarshalJSON() ([]byte, error) { + type Properties AWSEMRInstanceFleetConfig + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEMRInstanceFleetConfig) UnmarshalJSON(b []byte) error { + type Properties AWSEMRInstanceFleetConfig + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEMRInstanceFleetConfig(*res.Properties) + } + + return nil +} + +// GetAllAWSEMRInstanceFleetConfigResources retrieves all AWSEMRInstanceFleetConfig items from an AWS CloudFormation template +func (t *Template) GetAllAWSEMRInstanceFleetConfigResources() map[string]AWSEMRInstanceFleetConfig { + results := map[string]AWSEMRInstanceFleetConfig{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEMRInstanceFleetConfig: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::InstanceFleetConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRInstanceFleetConfig + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEMRInstanceFleetConfigWithName retrieves all AWSEMRInstanceFleetConfig items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEMRInstanceFleetConfigWithName(name string) (AWSEMRInstanceFleetConfig, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEMRInstanceFleetConfig: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::InstanceFleetConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRInstanceFleetConfig + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEMRInstanceFleetConfig{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_configuration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_configuration.go new file mode 100644 index 0000000000..6b2da60364 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_configuration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRInstanceFleetConfig_Configuration AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig.Configuration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-configuration.html +type AWSEMRInstanceFleetConfig_Configuration struct { + + // Classification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-configuration.html#cfn-elasticmapreduce-instancefleetconfig-configuration-classification + Classification string `json:"Classification,omitempty"` + + // ConfigurationProperties AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-configuration.html#cfn-elasticmapreduce-instancefleetconfig-configuration-configurationproperties + ConfigurationProperties map[string]string `json:"ConfigurationProperties,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-configuration.html#cfn-elasticmapreduce-instancefleetconfig-configuration-configurations + Configurations []AWSEMRInstanceFleetConfig_Configuration `json:"Configurations,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_Configuration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.Configuration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceFleetConfig_Configuration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_ebsblockdeviceconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_ebsblockdeviceconfig.go new file mode 100644 index 0000000000..ad9bccdef6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_ebsblockdeviceconfig.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig.EbsBlockDeviceConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig.html +type AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig struct { + + // VolumeSpecification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig.html#cfn-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig-volumespecification + VolumeSpecification *AWSEMRInstanceFleetConfig_VolumeSpecification `json:"VolumeSpecification,omitempty"` + + // VolumesPerInstance AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig.html#cfn-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig-volumesperinstance + VolumesPerInstance int `json:"VolumesPerInstance,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.EbsBlockDeviceConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_ebsconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_ebsconfiguration.go new file mode 100644 index 0000000000..6d28fc2103 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_ebsconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRInstanceFleetConfig_EbsConfiguration AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig.EbsConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsconfiguration.html +type AWSEMRInstanceFleetConfig_EbsConfiguration struct { + + // EbsBlockDeviceConfigs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsconfiguration.html#cfn-elasticmapreduce-instancefleetconfig-ebsconfiguration-ebsblockdeviceconfigs + EbsBlockDeviceConfigs []AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig `json:"EbsBlockDeviceConfigs,omitempty"` + + // EbsOptimized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsconfiguration.html#cfn-elasticmapreduce-instancefleetconfig-ebsconfiguration-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_EbsConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.EbsConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceFleetConfig_EbsConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_instancefleetprovisioningspecifications.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_instancefleetprovisioningspecifications.go new file mode 100644 index 0000000000..29e2305a18 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_instancefleetprovisioningspecifications.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEMRInstanceFleetConfig_InstanceFleetProvisioningSpecifications AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig.InstanceFleetProvisioningSpecifications) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancefleetprovisioningspecifications.html +type AWSEMRInstanceFleetConfig_InstanceFleetProvisioningSpecifications struct { + + // SpotSpecification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancefleetprovisioningspecifications.html#cfn-elasticmapreduce-instancefleetconfig-instancefleetprovisioningspecifications-spotspecification + SpotSpecification *AWSEMRInstanceFleetConfig_SpotProvisioningSpecification `json:"SpotSpecification,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_InstanceFleetProvisioningSpecifications) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.InstanceFleetProvisioningSpecifications" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceFleetConfig_InstanceFleetProvisioningSpecifications) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_instancetypeconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_instancetypeconfig.go new file mode 100644 index 0000000000..3fd8f6d1a5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_instancetypeconfig.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSEMRInstanceFleetConfig_InstanceTypeConfig AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig.InstanceTypeConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancetypeconfig.html +type AWSEMRInstanceFleetConfig_InstanceTypeConfig struct { + + // BidPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancetypeconfig.html#cfn-elasticmapreduce-instancefleetconfig-instancetypeconfig-bidprice + BidPrice string `json:"BidPrice,omitempty"` + + // BidPriceAsPercentageOfOnDemandPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancetypeconfig.html#cfn-elasticmapreduce-instancefleetconfig-instancetypeconfig-bidpriceaspercentageofondemandprice + BidPriceAsPercentageOfOnDemandPrice float64 `json:"BidPriceAsPercentageOfOnDemandPrice,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancetypeconfig.html#cfn-elasticmapreduce-instancefleetconfig-instancetypeconfig-configurations + Configurations []AWSEMRInstanceFleetConfig_Configuration `json:"Configurations,omitempty"` + + // EbsConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancetypeconfig.html#cfn-elasticmapreduce-instancefleetconfig-instancetypeconfig-ebsconfiguration + EbsConfiguration *AWSEMRInstanceFleetConfig_EbsConfiguration `json:"EbsConfiguration,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancetypeconfig.html#cfn-elasticmapreduce-instancefleetconfig-instancetypeconfig-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // WeightedCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-instancetypeconfig.html#cfn-elasticmapreduce-instancefleetconfig-instancetypeconfig-weightedcapacity + WeightedCapacity int `json:"WeightedCapacity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_InstanceTypeConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.InstanceTypeConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceFleetConfig_InstanceTypeConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_spotprovisioningspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_spotprovisioningspecification.go new file mode 100644 index 0000000000..c7efe9f621 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_spotprovisioningspecification.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRInstanceFleetConfig_SpotProvisioningSpecification AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig.SpotProvisioningSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-spotprovisioningspecification.html +type AWSEMRInstanceFleetConfig_SpotProvisioningSpecification struct { + + // BlockDurationMinutes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-spotprovisioningspecification.html#cfn-elasticmapreduce-instancefleetconfig-spotprovisioningspecification-blockdurationminutes + BlockDurationMinutes int `json:"BlockDurationMinutes,omitempty"` + + // TimeoutAction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-spotprovisioningspecification.html#cfn-elasticmapreduce-instancefleetconfig-spotprovisioningspecification-timeoutaction + TimeoutAction string `json:"TimeoutAction,omitempty"` + + // TimeoutDurationMinutes AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-spotprovisioningspecification.html#cfn-elasticmapreduce-instancefleetconfig-spotprovisioningspecification-timeoutdurationminutes + TimeoutDurationMinutes int `json:"TimeoutDurationMinutes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_SpotProvisioningSpecification) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.SpotProvisioningSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceFleetConfig_SpotProvisioningSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_volumespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_volumespecification.go new file mode 100644 index 0000000000..3165cb12f3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_volumespecification.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRInstanceFleetConfig_VolumeSpecification AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig.VolumeSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-volumespecification.html +type AWSEMRInstanceFleetConfig_VolumeSpecification struct { + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-volumespecification.html#cfn-elasticmapreduce-instancefleetconfig-volumespecification-iops + Iops int `json:"Iops,omitempty"` + + // SizeInGB AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-volumespecification.html#cfn-elasticmapreduce-instancefleetconfig-volumespecification-sizeingb + SizeInGB int `json:"SizeInGB,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-volumespecification.html#cfn-elasticmapreduce-instancefleetconfig-volumespecification-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_VolumeSpecification) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.VolumeSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceFleetConfig_VolumeSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig.go new file mode 100644 index 0000000000..62206c8668 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig.go @@ -0,0 +1,160 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEMRInstanceGroupConfig AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html +type AWSEMRInstanceGroupConfig struct { + + // AutoScalingPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-elasticmapreduce-instancegroupconfig-autoscalingpolicy + AutoScalingPolicy *AWSEMRInstanceGroupConfig_AutoScalingPolicy `json:"AutoScalingPolicy,omitempty"` + + // BidPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfig-bidprice + BidPrice string `json:"BidPrice,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfig-configurations + Configurations []AWSEMRInstanceGroupConfig_Configuration `json:"Configurations,omitempty"` + + // EbsConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfig-ebsconfiguration + EbsConfiguration *AWSEMRInstanceGroupConfig_EbsConfiguration `json:"EbsConfiguration,omitempty"` + + // InstanceCount AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfiginstancecount- + InstanceCount int `json:"InstanceCount,omitempty"` + + // InstanceRole AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfig-instancerole + InstanceRole string `json:"InstanceRole,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfig-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // JobFlowId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfig-jobflowid + JobFlowId string `json:"JobFlowId,omitempty"` + + // Market AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfig-market + Market string `json:"Market,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html#cfn-emr-instancegroupconfig-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEMRInstanceGroupConfig) MarshalJSON() ([]byte, error) { + type Properties AWSEMRInstanceGroupConfig + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEMRInstanceGroupConfig) UnmarshalJSON(b []byte) error { + type Properties AWSEMRInstanceGroupConfig + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEMRInstanceGroupConfig(*res.Properties) + } + + return nil +} + +// GetAllAWSEMRInstanceGroupConfigResources retrieves all AWSEMRInstanceGroupConfig items from an AWS CloudFormation template +func (t *Template) GetAllAWSEMRInstanceGroupConfigResources() map[string]AWSEMRInstanceGroupConfig { + results := map[string]AWSEMRInstanceGroupConfig{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEMRInstanceGroupConfig: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::InstanceGroupConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRInstanceGroupConfig + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEMRInstanceGroupConfigWithName retrieves all AWSEMRInstanceGroupConfig items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEMRInstanceGroupConfigWithName(name string) (AWSEMRInstanceGroupConfig, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEMRInstanceGroupConfig: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::InstanceGroupConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRInstanceGroupConfig + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEMRInstanceGroupConfig{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_autoscalingpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_autoscalingpolicy.go new file mode 100644 index 0000000000..2a30a27edd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_autoscalingpolicy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_AutoScalingPolicy AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.AutoScalingPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-autoscalingpolicy.html +type AWSEMRInstanceGroupConfig_AutoScalingPolicy struct { + + // Constraints AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-autoscalingpolicy.html#cfn-elasticmapreduce-instancegroupconfig-autoscalingpolicy-constraints + Constraints *AWSEMRInstanceGroupConfig_ScalingConstraints `json:"Constraints,omitempty"` + + // Rules AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-autoscalingpolicy.html#cfn-elasticmapreduce-instancegroupconfig-autoscalingpolicy-rules + Rules []AWSEMRInstanceGroupConfig_ScalingRule `json:"Rules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_AutoScalingPolicy) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.AutoScalingPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_AutoScalingPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_cloudwatchalarmdefinition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_cloudwatchalarmdefinition.go new file mode 100644 index 0000000000..f83cd6574c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_cloudwatchalarmdefinition.go @@ -0,0 +1,61 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_CloudWatchAlarmDefinition AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.CloudWatchAlarmDefinition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html +type AWSEMRInstanceGroupConfig_CloudWatchAlarmDefinition struct { + + // ComparisonOperator AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-comparisonoperator + ComparisonOperator string `json:"ComparisonOperator,omitempty"` + + // Dimensions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-dimensions + Dimensions []AWSEMRInstanceGroupConfig_MetricDimension `json:"Dimensions,omitempty"` + + // EvaluationPeriods AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-evaluationperiods + EvaluationPeriods int `json:"EvaluationPeriods,omitempty"` + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-metricname + MetricName string `json:"MetricName,omitempty"` + + // Namespace AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-namespace + Namespace string `json:"Namespace,omitempty"` + + // Period AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-period + Period int `json:"Period,omitempty"` + + // Statistic AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-statistic + Statistic string `json:"Statistic,omitempty"` + + // Threshold AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-threshold + Threshold float64 `json:"Threshold,omitempty"` + + // Unit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html#cfn-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition-unit + Unit string `json:"Unit,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_CloudWatchAlarmDefinition) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.CloudWatchAlarmDefinition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_CloudWatchAlarmDefinition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_configuration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_configuration.go new file mode 100644 index 0000000000..446b811070 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_configuration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_Configuration AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.Configuration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html +type AWSEMRInstanceGroupConfig_Configuration struct { + + // Classification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html#cfn-emr-cluster-configuration-classification + Classification string `json:"Classification,omitempty"` + + // ConfigurationProperties AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html#cfn-emr-cluster-configuration-configurationproperties + ConfigurationProperties map[string]string `json:"ConfigurationProperties,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-configuration.html#cfn-emr-cluster-configuration-configurations + Configurations []AWSEMRInstanceGroupConfig_Configuration `json:"Configurations,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_Configuration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.Configuration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_Configuration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_ebsblockdeviceconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_ebsblockdeviceconfig.go new file mode 100644 index 0000000000..1c55cd608f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_ebsblockdeviceconfig.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_EbsBlockDeviceConfig AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.EbsBlockDeviceConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig.html +type AWSEMRInstanceGroupConfig_EbsBlockDeviceConfig struct { + + // VolumeSpecification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification + VolumeSpecification *AWSEMRInstanceGroupConfig_VolumeSpecification `json:"VolumeSpecification,omitempty"` + + // VolumesPerInstance AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumesperinstance + VolumesPerInstance int `json:"VolumesPerInstance,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_EbsBlockDeviceConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.EbsBlockDeviceConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_EbsBlockDeviceConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_ebsconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_ebsconfiguration.go new file mode 100644 index 0000000000..4a813522f7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_ebsconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_EbsConfiguration AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.EbsConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration.html +type AWSEMRInstanceGroupConfig_EbsConfiguration struct { + + // EbsBlockDeviceConfigs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfigs + EbsBlockDeviceConfigs []AWSEMRInstanceGroupConfig_EbsBlockDeviceConfig `json:"EbsBlockDeviceConfigs,omitempty"` + + // EbsOptimized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration.html#cfn-emr-ebsconfiguration-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_EbsConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.EbsConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_EbsConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_metricdimension.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_metricdimension.go new file mode 100644 index 0000000000..c544245912 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_metricdimension.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_MetricDimension AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.MetricDimension) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-metricdimension.html +type AWSEMRInstanceGroupConfig_MetricDimension struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-metricdimension.html#cfn-elasticmapreduce-instancegroupconfig-metricdimension-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-metricdimension.html#cfn-elasticmapreduce-instancegroupconfig-metricdimension-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_MetricDimension) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.MetricDimension" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_MetricDimension) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingaction.go new file mode 100644 index 0000000000..72bc0da143 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingaction.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_ScalingAction AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.ScalingAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingaction.html +type AWSEMRInstanceGroupConfig_ScalingAction struct { + + // Market AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingaction.html#cfn-elasticmapreduce-instancegroupconfig-scalingaction-market + Market string `json:"Market,omitempty"` + + // SimpleScalingPolicyConfiguration AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingaction.html#cfn-elasticmapreduce-instancegroupconfig-scalingaction-simplescalingpolicyconfiguration + SimpleScalingPolicyConfiguration *AWSEMRInstanceGroupConfig_SimpleScalingPolicyConfiguration `json:"SimpleScalingPolicyConfiguration,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_ScalingAction) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.ScalingAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_ScalingAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingconstraints.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingconstraints.go new file mode 100644 index 0000000000..1a8bdd0fbe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingconstraints.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_ScalingConstraints AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.ScalingConstraints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingconstraints.html +type AWSEMRInstanceGroupConfig_ScalingConstraints struct { + + // MaxCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingconstraints.html#cfn-elasticmapreduce-instancegroupconfig-scalingconstraints-maxcapacity + MaxCapacity int `json:"MaxCapacity,omitempty"` + + // MinCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingconstraints.html#cfn-elasticmapreduce-instancegroupconfig-scalingconstraints-mincapacity + MinCapacity int `json:"MinCapacity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_ScalingConstraints) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.ScalingConstraints" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_ScalingConstraints) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingrule.go new file mode 100644 index 0000000000..44629f9017 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingrule.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_ScalingRule AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.ScalingRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingrule.html +type AWSEMRInstanceGroupConfig_ScalingRule struct { + + // Action AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingrule.html#cfn-elasticmapreduce-instancegroupconfig-scalingrule-action + Action *AWSEMRInstanceGroupConfig_ScalingAction `json:"Action,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingrule.html#cfn-elasticmapreduce-instancegroupconfig-scalingrule-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingrule.html#cfn-elasticmapreduce-instancegroupconfig-scalingrule-name + Name string `json:"Name,omitempty"` + + // Trigger AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingrule.html#cfn-elasticmapreduce-instancegroupconfig-scalingrule-trigger + Trigger *AWSEMRInstanceGroupConfig_ScalingTrigger `json:"Trigger,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_ScalingRule) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.ScalingRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_ScalingRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingtrigger.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingtrigger.go new file mode 100644 index 0000000000..bb183f14b9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingtrigger.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_ScalingTrigger AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.ScalingTrigger) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingtrigger.html +type AWSEMRInstanceGroupConfig_ScalingTrigger struct { + + // CloudWatchAlarmDefinition AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingtrigger.html#cfn-elasticmapreduce-instancegroupconfig-scalingtrigger-cloudwatchalarmdefinition + CloudWatchAlarmDefinition *AWSEMRInstanceGroupConfig_CloudWatchAlarmDefinition `json:"CloudWatchAlarmDefinition,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_ScalingTrigger) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.ScalingTrigger" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_ScalingTrigger) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_simplescalingpolicyconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_simplescalingpolicyconfiguration.go new file mode 100644 index 0000000000..01a656678b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_simplescalingpolicyconfiguration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_SimpleScalingPolicyConfiguration AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.SimpleScalingPolicyConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-simplescalingpolicyconfiguration.html +type AWSEMRInstanceGroupConfig_SimpleScalingPolicyConfiguration struct { + + // AdjustmentType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-simplescalingpolicyconfiguration.html#cfn-elasticmapreduce-instancegroupconfig-simplescalingpolicyconfiguration-adjustmenttype + AdjustmentType string `json:"AdjustmentType,omitempty"` + + // CoolDown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-simplescalingpolicyconfiguration.html#cfn-elasticmapreduce-instancegroupconfig-simplescalingpolicyconfiguration-cooldown + CoolDown int `json:"CoolDown,omitempty"` + + // ScalingAdjustment AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-simplescalingpolicyconfiguration.html#cfn-elasticmapreduce-instancegroupconfig-simplescalingpolicyconfiguration-scalingadjustment + ScalingAdjustment int `json:"ScalingAdjustment,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_SimpleScalingPolicyConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.SimpleScalingPolicyConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_SimpleScalingPolicyConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_volumespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_volumespecification.go new file mode 100644 index 0000000000..5d9e712d2a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_volumespecification.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSEMRInstanceGroupConfig_VolumeSpecification AWS CloudFormation Resource (AWS::EMR::InstanceGroupConfig.VolumeSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification.html +type AWSEMRInstanceGroupConfig_VolumeSpecification struct { + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification-iops + Iops int `json:"Iops,omitempty"` + + // SizeInGB AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification-sizeingb + SizeInGB int `json:"SizeInGB,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification.html#cfn-emr-ebsconfiguration-ebsblockdeviceconfig-volumespecification-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_VolumeSpecification) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.VolumeSpecification" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRInstanceGroupConfig_VolumeSpecification) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-securityconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-securityconfiguration.go new file mode 100644 index 0000000000..58b80af3b7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-securityconfiguration.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEMRSecurityConfiguration AWS CloudFormation Resource (AWS::EMR::SecurityConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-securityconfiguration.html +type AWSEMRSecurityConfiguration struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-securityconfiguration.html#cfn-emr-securityconfiguration-name + Name string `json:"Name,omitempty"` + + // SecurityConfiguration AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-securityconfiguration.html#cfn-emr-securityconfiguration-securityconfiguration + SecurityConfiguration interface{} `json:"SecurityConfiguration,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRSecurityConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::SecurityConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRSecurityConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEMRSecurityConfiguration) MarshalJSON() ([]byte, error) { + type Properties AWSEMRSecurityConfiguration + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEMRSecurityConfiguration) UnmarshalJSON(b []byte) error { + type Properties AWSEMRSecurityConfiguration + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEMRSecurityConfiguration(*res.Properties) + } + + return nil +} + +// GetAllAWSEMRSecurityConfigurationResources retrieves all AWSEMRSecurityConfiguration items from an AWS CloudFormation template +func (t *Template) GetAllAWSEMRSecurityConfigurationResources() map[string]AWSEMRSecurityConfiguration { + results := map[string]AWSEMRSecurityConfiguration{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEMRSecurityConfiguration: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::SecurityConfiguration" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRSecurityConfiguration + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEMRSecurityConfigurationWithName retrieves all AWSEMRSecurityConfiguration items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEMRSecurityConfigurationWithName(name string) (AWSEMRSecurityConfiguration, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEMRSecurityConfiguration: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::SecurityConfiguration" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRSecurityConfiguration + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEMRSecurityConfiguration{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step.go new file mode 100644 index 0000000000..e5aa1b38f1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEMRStep AWS CloudFormation Resource (AWS::EMR::Step) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-step.html +type AWSEMRStep struct { + + // ActionOnFailure AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-step.html#cfn-elasticmapreduce-step-actiononfailure + ActionOnFailure string `json:"ActionOnFailure,omitempty"` + + // HadoopJarStep AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-step.html#cfn-elasticmapreduce-step-hadoopjarstep + HadoopJarStep *AWSEMRStep_HadoopJarStepConfig `json:"HadoopJarStep,omitempty"` + + // JobFlowId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-step.html#cfn-elasticmapreduce-step-jobflowid + JobFlowId string `json:"JobFlowId,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-step.html#cfn-elasticmapreduce-step-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRStep) AWSCloudFormationType() string { + return "AWS::EMR::Step" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRStep) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEMRStep) MarshalJSON() ([]byte, error) { + type Properties AWSEMRStep + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEMRStep) UnmarshalJSON(b []byte) error { + type Properties AWSEMRStep + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEMRStep(*res.Properties) + } + + return nil +} + +// GetAllAWSEMRStepResources retrieves all AWSEMRStep items from an AWS CloudFormation template +func (t *Template) GetAllAWSEMRStepResources() map[string]AWSEMRStep { + results := map[string]AWSEMRStep{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEMRStep: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::Step" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRStep + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEMRStepWithName retrieves all AWSEMRStep items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEMRStepWithName(name string) (AWSEMRStep, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEMRStep: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::EMR::Step" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEMRStep + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEMRStep{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step_hadoopjarstepconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step_hadoopjarstepconfig.go new file mode 100644 index 0000000000..062450a1e3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step_hadoopjarstepconfig.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSEMRStep_HadoopJarStepConfig AWS CloudFormation Resource (AWS::EMR::Step.HadoopJarStepConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-step-hadoopjarstepconfig.html +type AWSEMRStep_HadoopJarStepConfig struct { + + // Args AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-step-hadoopjarstepconfig.html#cfn-elasticmapreduce-step-hadoopjarstepconfig-args + Args []string `json:"Args,omitempty"` + + // Jar AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-step-hadoopjarstepconfig.html#cfn-elasticmapreduce-step-hadoopjarstepconfig-jar + Jar string `json:"Jar,omitempty"` + + // MainClass AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-step-hadoopjarstepconfig.html#cfn-elasticmapreduce-step-hadoopjarstepconfig-mainclass + MainClass string `json:"MainClass,omitempty"` + + // StepProperties AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-step-hadoopjarstepconfig.html#cfn-elasticmapreduce-step-hadoopjarstepconfig-stepproperties + StepProperties []AWSEMRStep_KeyValue `json:"StepProperties,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRStep_HadoopJarStepConfig) AWSCloudFormationType() string { + return "AWS::EMR::Step.HadoopJarStepConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRStep_HadoopJarStepConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step_keyvalue.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step_keyvalue.go new file mode 100644 index 0000000000..b07b94dd94 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step_keyvalue.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSEMRStep_KeyValue AWS CloudFormation Resource (AWS::EMR::Step.KeyValue) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-step-keyvalue.html +type AWSEMRStep_KeyValue struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-step-keyvalue.html#cfn-elasticmapreduce-step-keyvalue-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-step-keyvalue.html#cfn-elasticmapreduce-step-keyvalue-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRStep_KeyValue) AWSCloudFormationType() string { + return "AWS::EMR::Step.KeyValue" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEMRStep_KeyValue) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule.go new file mode 100644 index 0000000000..ff05678994 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEventsRule AWS CloudFormation Resource (AWS::Events::Rule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html +type AWSEventsRule struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-description + Description string `json:"Description,omitempty"` + + // EventPattern AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventpattern + EventPattern interface{} `json:"EventPattern,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-name + Name string `json:"Name,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // ScheduleExpression AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-scheduleexpression + ScheduleExpression string `json:"ScheduleExpression,omitempty"` + + // State AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-state + State string `json:"State,omitempty"` + + // Targets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-targets + Targets []AWSEventsRule_Target `json:"Targets,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule) AWSCloudFormationType() string { + return "AWS::Events::Rule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEventsRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSEventsRule) MarshalJSON() ([]byte, error) { + type Properties AWSEventsRule + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEventsRule) UnmarshalJSON(b []byte) error { + type Properties AWSEventsRule + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSEventsRule(*res.Properties) + } + + return nil +} + +// GetAllAWSEventsRuleResources retrieves all AWSEventsRule items from an AWS CloudFormation template +func (t *Template) GetAllAWSEventsRuleResources() map[string]AWSEventsRule { + results := map[string]AWSEventsRule{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEventsRule: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Events::Rule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEventsRule + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEventsRuleWithName retrieves all AWSEventsRule items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEventsRuleWithName(name string) (AWSEventsRule, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEventsRule: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Events::Rule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEventsRule + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEventsRule{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_target.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_target.go new file mode 100644 index 0000000000..834c0d47c0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_target.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSEventsRule_Target AWS CloudFormation Resource (AWS::Events::Rule.Target) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html +type AWSEventsRule_Target struct { + + // Arn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-arn + Arn string `json:"Arn,omitempty"` + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-id + Id string `json:"Id,omitempty"` + + // Input AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-input + Input string `json:"Input,omitempty"` + + // InputPath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-inputpath + InputPath string `json:"InputPath,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-rolearn + RoleArn string `json:"RoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule_Target) AWSCloudFormationType() string { + return "AWS::Events::Rule.Target" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSEventsRule_Target) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-alias.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-alias.go new file mode 100644 index 0000000000..4ccba8a93f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-alias.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGameLiftAlias AWS CloudFormation Resource (AWS::GameLift::Alias) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-alias.html +type AWSGameLiftAlias struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-alias.html#cfn-gamelift-alias-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-alias.html#cfn-gamelift-alias-name + Name string `json:"Name,omitempty"` + + // RoutingStrategy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-alias.html#cfn-gamelift-alias-routingstrategy + RoutingStrategy *AWSGameLiftAlias_RoutingStrategy `json:"RoutingStrategy,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftAlias) AWSCloudFormationType() string { + return "AWS::GameLift::Alias" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSGameLiftAlias) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSGameLiftAlias) MarshalJSON() ([]byte, error) { + type Properties AWSGameLiftAlias + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGameLiftAlias) UnmarshalJSON(b []byte) error { + type Properties AWSGameLiftAlias + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSGameLiftAlias(*res.Properties) + } + + return nil +} + +// GetAllAWSGameLiftAliasResources retrieves all AWSGameLiftAlias items from an AWS CloudFormation template +func (t *Template) GetAllAWSGameLiftAliasResources() map[string]AWSGameLiftAlias { + results := map[string]AWSGameLiftAlias{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGameLiftAlias: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::GameLift::Alias" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGameLiftAlias + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGameLiftAliasWithName retrieves all AWSGameLiftAlias items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGameLiftAliasWithName(name string) (AWSGameLiftAlias, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGameLiftAlias: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::GameLift::Alias" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGameLiftAlias + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGameLiftAlias{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-alias_routingstrategy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-alias_routingstrategy.go new file mode 100644 index 0000000000..9b747295dd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-alias_routingstrategy.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSGameLiftAlias_RoutingStrategy AWS CloudFormation Resource (AWS::GameLift::Alias.RoutingStrategy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-alias-routingstrategy.html +type AWSGameLiftAlias_RoutingStrategy struct { + + // FleetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-alias-routingstrategy.html#cfn-gamelift-alias-routingstrategy-fleetid + FleetId string `json:"FleetId,omitempty"` + + // Message AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-alias-routingstrategy.html#cfn-gamelift-alias-routingstrategy-message + Message string `json:"Message,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-alias-routingstrategy.html#cfn-gamelift-alias-routingstrategy-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftAlias_RoutingStrategy) AWSCloudFormationType() string { + return "AWS::GameLift::Alias.RoutingStrategy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSGameLiftAlias_RoutingStrategy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-build.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-build.go new file mode 100644 index 0000000000..58bac9223d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-build.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGameLiftBuild AWS CloudFormation Resource (AWS::GameLift::Build) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-build.html +type AWSGameLiftBuild struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-build.html#cfn-gamelift-build-name + Name string `json:"Name,omitempty"` + + // StorageLocation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-build.html#cfn-gamelift-build-storagelocation + StorageLocation *AWSGameLiftBuild_S3Location `json:"StorageLocation,omitempty"` + + // Version AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-build.html#cfn-gamelift-build-version + Version string `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftBuild) AWSCloudFormationType() string { + return "AWS::GameLift::Build" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSGameLiftBuild) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSGameLiftBuild) MarshalJSON() ([]byte, error) { + type Properties AWSGameLiftBuild + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGameLiftBuild) UnmarshalJSON(b []byte) error { + type Properties AWSGameLiftBuild + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSGameLiftBuild(*res.Properties) + } + + return nil +} + +// GetAllAWSGameLiftBuildResources retrieves all AWSGameLiftBuild items from an AWS CloudFormation template +func (t *Template) GetAllAWSGameLiftBuildResources() map[string]AWSGameLiftBuild { + results := map[string]AWSGameLiftBuild{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGameLiftBuild: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::GameLift::Build" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGameLiftBuild + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGameLiftBuildWithName retrieves all AWSGameLiftBuild items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGameLiftBuildWithName(name string) (AWSGameLiftBuild, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGameLiftBuild: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::GameLift::Build" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGameLiftBuild + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGameLiftBuild{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-build_s3location.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-build_s3location.go new file mode 100644 index 0000000000..384d9e0426 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-build_s3location.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSGameLiftBuild_S3Location AWS CloudFormation Resource (AWS::GameLift::Build.S3Location) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-build-storagelocation.html +type AWSGameLiftBuild_S3Location struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-build-storagelocation.html#cfn-gamelift-build-storage-bucket + Bucket string `json:"Bucket,omitempty"` + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-build-storagelocation.html#cfn-gamelift-build-storage-key + Key string `json:"Key,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-build-storagelocation.html#cfn-gamelift-build-storage-rolearn + RoleArn string `json:"RoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftBuild_S3Location) AWSCloudFormationType() string { + return "AWS::GameLift::Build.S3Location" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSGameLiftBuild_S3Location) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-fleet.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-fleet.go new file mode 100644 index 0000000000..4560c4aa4a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-fleet.go @@ -0,0 +1,165 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGameLiftFleet AWS CloudFormation Resource (AWS::GameLift::Fleet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html +type AWSGameLiftFleet struct { + + // BuildId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-buildid + BuildId string `json:"BuildId,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-description + Description string `json:"Description,omitempty"` + + // DesiredEC2Instances AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-desiredec2instances + DesiredEC2Instances int `json:"DesiredEC2Instances,omitempty"` + + // EC2InboundPermissions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-ec2inboundpermissions + EC2InboundPermissions []AWSGameLiftFleet_IpPermission `json:"EC2InboundPermissions,omitempty"` + + // EC2InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-ec2instancetype + EC2InstanceType string `json:"EC2InstanceType,omitempty"` + + // LogPaths AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-logpaths + LogPaths []string `json:"LogPaths,omitempty"` + + // MaxSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-maxsize + MaxSize int `json:"MaxSize,omitempty"` + + // MinSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-minsize + MinSize int `json:"MinSize,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-name + Name string `json:"Name,omitempty"` + + // ServerLaunchParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-serverlaunchparameters + ServerLaunchParameters string `json:"ServerLaunchParameters,omitempty"` + + // ServerLaunchPath AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-serverlaunchpath + ServerLaunchPath string `json:"ServerLaunchPath,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftFleet) AWSCloudFormationType() string { + return "AWS::GameLift::Fleet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSGameLiftFleet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSGameLiftFleet) MarshalJSON() ([]byte, error) { + type Properties AWSGameLiftFleet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGameLiftFleet) UnmarshalJSON(b []byte) error { + type Properties AWSGameLiftFleet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSGameLiftFleet(*res.Properties) + } + + return nil +} + +// GetAllAWSGameLiftFleetResources retrieves all AWSGameLiftFleet items from an AWS CloudFormation template +func (t *Template) GetAllAWSGameLiftFleetResources() map[string]AWSGameLiftFleet { + results := map[string]AWSGameLiftFleet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGameLiftFleet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::GameLift::Fleet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGameLiftFleet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGameLiftFleetWithName retrieves all AWSGameLiftFleet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGameLiftFleetWithName(name string) (AWSGameLiftFleet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGameLiftFleet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::GameLift::Fleet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGameLiftFleet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGameLiftFleet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-fleet_ippermission.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-fleet_ippermission.go new file mode 100644 index 0000000000..eaf7196987 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-fleet_ippermission.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSGameLiftFleet_IpPermission AWS CloudFormation Resource (AWS::GameLift::Fleet.IpPermission) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-fleet-ec2inboundpermission.html +type AWSGameLiftFleet_IpPermission struct { + + // FromPort AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-fleet-ec2inboundpermission.html#cfn-gamelift-fleet-ec2inboundpermissions-fromport + FromPort int `json:"FromPort,omitempty"` + + // IpRange AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-fleet-ec2inboundpermission.html#cfn-gamelift-fleet-ec2inboundpermissions-iprange + IpRange string `json:"IpRange,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-fleet-ec2inboundpermission.html#cfn-gamelift-fleet-ec2inboundpermissions-protocol + Protocol string `json:"Protocol,omitempty"` + + // ToPort AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-gamelift-fleet-ec2inboundpermission.html#cfn-gamelift-fleet-ec2inboundpermissions-toport + ToPort int `json:"ToPort,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftFleet_IpPermission) AWSCloudFormationType() string { + return "AWS::GameLift::Fleet.IpPermission" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSGameLiftFleet_IpPermission) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-accesskey.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-accesskey.go new file mode 100644 index 0000000000..e5de9ad0a0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-accesskey.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMAccessKey AWS CloudFormation Resource (AWS::IAM::AccessKey) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html +type AWSIAMAccessKey struct { + + // Serial AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html#cfn-iam-accesskey-serial + Serial int `json:"Serial,omitempty"` + + // Status AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html#cfn-iam-accesskey-status + Status string `json:"Status,omitempty"` + + // UserName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html#cfn-iam-accesskey-username + UserName string `json:"UserName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMAccessKey) AWSCloudFormationType() string { + return "AWS::IAM::AccessKey" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMAccessKey) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIAMAccessKey) MarshalJSON() ([]byte, error) { + type Properties AWSIAMAccessKey + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMAccessKey) UnmarshalJSON(b []byte) error { + type Properties AWSIAMAccessKey + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIAMAccessKey(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMAccessKeyResources retrieves all AWSIAMAccessKey items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMAccessKeyResources() map[string]AWSIAMAccessKey { + results := map[string]AWSIAMAccessKey{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMAccessKey: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::AccessKey" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMAccessKey + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMAccessKeyWithName retrieves all AWSIAMAccessKey items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMAccessKeyWithName(name string) (AWSIAMAccessKey, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMAccessKey: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::AccessKey" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMAccessKey + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMAccessKey{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-group.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-group.go new file mode 100644 index 0000000000..97603df5a2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-group.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMGroup AWS CloudFormation Resource (AWS::IAM::Group) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html +type AWSIAMGroup struct { + + // GroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html#cfn-iam-group-groupname + GroupName string `json:"GroupName,omitempty"` + + // ManagedPolicyArns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html#cfn-iam-group-managepolicyarns + ManagedPolicyArns []string `json:"ManagedPolicyArns,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html#cfn-iam-group-path + Path string `json:"Path,omitempty"` + + // Policies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html#cfn-iam-group-policies + Policies []AWSIAMGroup_Policy `json:"Policies,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMGroup) AWSCloudFormationType() string { + return "AWS::IAM::Group" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIAMGroup) MarshalJSON() ([]byte, error) { + type Properties AWSIAMGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMGroup) UnmarshalJSON(b []byte) error { + type Properties AWSIAMGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIAMGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMGroupResources retrieves all AWSIAMGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMGroupResources() map[string]AWSIAMGroup { + results := map[string]AWSIAMGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::Group" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMGroupWithName retrieves all AWSIAMGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMGroupWithName(name string) (AWSIAMGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::Group" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-group_policy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-group_policy.go new file mode 100644 index 0000000000..8d3bdd0179 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-group_policy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSIAMGroup_Policy AWS CloudFormation Resource (AWS::IAM::Group.Policy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html +type AWSIAMGroup_Policy struct { + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html#cfn-iam-policies-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // PolicyName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html#cfn-iam-policies-policyname + PolicyName string `json:"PolicyName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMGroup_Policy) AWSCloudFormationType() string { + return "AWS::IAM::Group.Policy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMGroup_Policy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-instanceprofile.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-instanceprofile.go new file mode 100644 index 0000000000..c99aaf2d0a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-instanceprofile.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMInstanceProfile AWS CloudFormation Resource (AWS::IAM::InstanceProfile) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html +type AWSIAMInstanceProfile struct { + + // InstanceProfileName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html#cfn-iam-instanceprofile-instanceprofilename + InstanceProfileName string `json:"InstanceProfileName,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html#cfn-iam-instanceprofile-path + Path string `json:"Path,omitempty"` + + // Roles AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html#cfn-iam-instanceprofile-roles + Roles []string `json:"Roles,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMInstanceProfile) AWSCloudFormationType() string { + return "AWS::IAM::InstanceProfile" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMInstanceProfile) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIAMInstanceProfile) MarshalJSON() ([]byte, error) { + type Properties AWSIAMInstanceProfile + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMInstanceProfile) UnmarshalJSON(b []byte) error { + type Properties AWSIAMInstanceProfile + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIAMInstanceProfile(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMInstanceProfileResources retrieves all AWSIAMInstanceProfile items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMInstanceProfileResources() map[string]AWSIAMInstanceProfile { + results := map[string]AWSIAMInstanceProfile{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMInstanceProfile: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::InstanceProfile" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMInstanceProfile + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMInstanceProfileWithName retrieves all AWSIAMInstanceProfile items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMInstanceProfileWithName(name string) (AWSIAMInstanceProfile, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMInstanceProfile: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::InstanceProfile" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMInstanceProfile + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMInstanceProfile{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-managedpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-managedpolicy.go new file mode 100644 index 0000000000..d7ffaaa8d8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-managedpolicy.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMManagedPolicy AWS CloudFormation Resource (AWS::IAM::ManagedPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html +type AWSIAMManagedPolicy struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html#cfn-iam-managedpolicy-description + Description string `json:"Description,omitempty"` + + // Groups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html#cfn-iam-managedpolicy-groups + Groups []string `json:"Groups,omitempty"` + + // ManagedPolicyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html#cfn-iam-managedpolicy-managedpolicyname + ManagedPolicyName string `json:"ManagedPolicyName,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html#cfn-ec2-dhcpoptions-path + Path string `json:"Path,omitempty"` + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html#cfn-iam-managedpolicy-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // Roles AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html#cfn-iam-managedpolicy-roles + Roles []string `json:"Roles,omitempty"` + + // Users AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html#cfn-iam-managedpolicy-users + Users []string `json:"Users,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMManagedPolicy) AWSCloudFormationType() string { + return "AWS::IAM::ManagedPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMManagedPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIAMManagedPolicy) MarshalJSON() ([]byte, error) { + type Properties AWSIAMManagedPolicy + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMManagedPolicy) UnmarshalJSON(b []byte) error { + type Properties AWSIAMManagedPolicy + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIAMManagedPolicy(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMManagedPolicyResources retrieves all AWSIAMManagedPolicy items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMManagedPolicyResources() map[string]AWSIAMManagedPolicy { + results := map[string]AWSIAMManagedPolicy{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMManagedPolicy: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::ManagedPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMManagedPolicy + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMManagedPolicyWithName retrieves all AWSIAMManagedPolicy items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMManagedPolicyWithName(name string) (AWSIAMManagedPolicy, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMManagedPolicy: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::ManagedPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMManagedPolicy + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMManagedPolicy{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-policy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-policy.go new file mode 100644 index 0000000000..30bf88d539 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-policy.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMPolicy AWS CloudFormation Resource (AWS::IAM::Policy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html +type AWSIAMPolicy struct { + + // Groups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-groups + Groups []string `json:"Groups,omitempty"` + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // PolicyName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-policyname + PolicyName string `json:"PolicyName,omitempty"` + + // Roles AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-roles + Roles []string `json:"Roles,omitempty"` + + // Users AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-users + Users []string `json:"Users,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMPolicy) AWSCloudFormationType() string { + return "AWS::IAM::Policy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIAMPolicy) MarshalJSON() ([]byte, error) { + type Properties AWSIAMPolicy + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMPolicy) UnmarshalJSON(b []byte) error { + type Properties AWSIAMPolicy + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIAMPolicy(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMPolicyResources retrieves all AWSIAMPolicy items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMPolicyResources() map[string]AWSIAMPolicy { + results := map[string]AWSIAMPolicy{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMPolicy: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::Policy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMPolicy + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMPolicyWithName retrieves all AWSIAMPolicy items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMPolicyWithName(name string) (AWSIAMPolicy, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMPolicy: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::Policy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMPolicy + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMPolicy{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-role.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-role.go new file mode 100644 index 0000000000..1fd26c36e6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-role.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMRole AWS CloudFormation Resource (AWS::IAM::Role) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html +type AWSIAMRole struct { + + // AssumeRolePolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-assumerolepolicydocument + AssumeRolePolicyDocument interface{} `json:"AssumeRolePolicyDocument,omitempty"` + + // ManagedPolicyArns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-managepolicyarns + ManagedPolicyArns []string `json:"ManagedPolicyArns,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-path + Path string `json:"Path,omitempty"` + + // Policies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-policies + Policies []AWSIAMRole_Policy `json:"Policies,omitempty"` + + // RoleName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-rolename + RoleName string `json:"RoleName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMRole) AWSCloudFormationType() string { + return "AWS::IAM::Role" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMRole) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIAMRole) MarshalJSON() ([]byte, error) { + type Properties AWSIAMRole + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMRole) UnmarshalJSON(b []byte) error { + type Properties AWSIAMRole + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIAMRole(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMRoleResources retrieves all AWSIAMRole items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMRoleResources() map[string]AWSIAMRole { + results := map[string]AWSIAMRole{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMRole: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::Role" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMRole + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMRoleWithName retrieves all AWSIAMRole items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMRoleWithName(name string) (AWSIAMRole, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMRole: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::Role" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMRole + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMRole{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-role_policy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-role_policy.go new file mode 100644 index 0000000000..2487179273 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-role_policy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSIAMRole_Policy AWS CloudFormation Resource (AWS::IAM::Role.Policy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html +type AWSIAMRole_Policy struct { + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html#cfn-iam-policies-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // PolicyName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html#cfn-iam-policies-policyname + PolicyName string `json:"PolicyName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMRole_Policy) AWSCloudFormationType() string { + return "AWS::IAM::Role.Policy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMRole_Policy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user.go new file mode 100644 index 0000000000..67dbe1f313 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMUser AWS CloudFormation Resource (AWS::IAM::User) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html +type AWSIAMUser struct { + + // Groups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html#cfn-iam-user-groups + Groups []string `json:"Groups,omitempty"` + + // LoginProfile AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html#cfn-iam-user-loginprofile + LoginProfile *AWSIAMUser_LoginProfile `json:"LoginProfile,omitempty"` + + // ManagedPolicyArns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html#cfn-iam-user-managepolicyarns + ManagedPolicyArns []string `json:"ManagedPolicyArns,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html#cfn-iam-user-path + Path string `json:"Path,omitempty"` + + // Policies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html#cfn-iam-user-policies + Policies []AWSIAMUser_Policy `json:"Policies,omitempty"` + + // UserName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html#cfn-iam-user-username + UserName string `json:"UserName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMUser) AWSCloudFormationType() string { + return "AWS::IAM::User" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMUser) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIAMUser) MarshalJSON() ([]byte, error) { + type Properties AWSIAMUser + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMUser) UnmarshalJSON(b []byte) error { + type Properties AWSIAMUser + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIAMUser(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMUserResources retrieves all AWSIAMUser items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMUserResources() map[string]AWSIAMUser { + results := map[string]AWSIAMUser{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMUser: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::User" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMUser + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMUserWithName retrieves all AWSIAMUser items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMUserWithName(name string) (AWSIAMUser, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMUser: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::User" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMUser + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMUser{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user_loginprofile.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user_loginprofile.go new file mode 100644 index 0000000000..ad3fd0c002 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user_loginprofile.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSIAMUser_LoginProfile AWS CloudFormation Resource (AWS::IAM::User.LoginProfile) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user-loginprofile.html +type AWSIAMUser_LoginProfile struct { + + // Password AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user-loginprofile.html#cfn-iam-user-loginprofile-password + Password string `json:"Password,omitempty"` + + // PasswordResetRequired AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user-loginprofile.html#cfn-iam-user-loginprofile-passwordresetrequired + PasswordResetRequired bool `json:"PasswordResetRequired,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMUser_LoginProfile) AWSCloudFormationType() string { + return "AWS::IAM::User.LoginProfile" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMUser_LoginProfile) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user_policy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user_policy.go new file mode 100644 index 0000000000..ae653185fe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user_policy.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSIAMUser_Policy AWS CloudFormation Resource (AWS::IAM::User.Policy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html +type AWSIAMUser_Policy struct { + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html#cfn-iam-policies-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // PolicyName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html#cfn-iam-policies-policyname + PolicyName string `json:"PolicyName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMUser_Policy) AWSCloudFormationType() string { + return "AWS::IAM::User.Policy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMUser_Policy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-usertogroupaddition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-usertogroupaddition.go new file mode 100644 index 0000000000..315b79fc88 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-usertogroupaddition.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMUserToGroupAddition AWS CloudFormation Resource (AWS::IAM::UserToGroupAddition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html +type AWSIAMUserToGroupAddition struct { + + // GroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html#cfn-iam-addusertogroup-groupname + GroupName string `json:"GroupName,omitempty"` + + // Users AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html#cfn-iam-addusertogroup-users + Users []string `json:"Users,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMUserToGroupAddition) AWSCloudFormationType() string { + return "AWS::IAM::UserToGroupAddition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIAMUserToGroupAddition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIAMUserToGroupAddition) MarshalJSON() ([]byte, error) { + type Properties AWSIAMUserToGroupAddition + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMUserToGroupAddition) UnmarshalJSON(b []byte) error { + type Properties AWSIAMUserToGroupAddition + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIAMUserToGroupAddition(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMUserToGroupAdditionResources retrieves all AWSIAMUserToGroupAddition items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMUserToGroupAdditionResources() map[string]AWSIAMUserToGroupAddition { + results := map[string]AWSIAMUserToGroupAddition{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMUserToGroupAddition: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::UserToGroupAddition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMUserToGroupAddition + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMUserToGroupAdditionWithName retrieves all AWSIAMUserToGroupAddition items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMUserToGroupAdditionWithName(name string) (AWSIAMUserToGroupAddition, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMUserToGroupAddition: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IAM::UserToGroupAddition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMUserToGroupAddition + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMUserToGroupAddition{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-certificate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-certificate.go new file mode 100644 index 0000000000..7e222b1ad6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-certificate.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIoTCertificate AWS CloudFormation Resource (AWS::IoT::Certificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-certificate.html +type AWSIoTCertificate struct { + + // CertificateSigningRequest AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-certificate.html#cfn-iot-certificate-certificatesigningrequest + CertificateSigningRequest string `json:"CertificateSigningRequest,omitempty"` + + // Status AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-certificate.html#cfn-iot-certificate-status + Status string `json:"Status,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTCertificate) AWSCloudFormationType() string { + return "AWS::IoT::Certificate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTCertificate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIoTCertificate) MarshalJSON() ([]byte, error) { + type Properties AWSIoTCertificate + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIoTCertificate) UnmarshalJSON(b []byte) error { + type Properties AWSIoTCertificate + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIoTCertificate(*res.Properties) + } + + return nil +} + +// GetAllAWSIoTCertificateResources retrieves all AWSIoTCertificate items from an AWS CloudFormation template +func (t *Template) GetAllAWSIoTCertificateResources() map[string]AWSIoTCertificate { + results := map[string]AWSIoTCertificate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIoTCertificate: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::Certificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTCertificate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIoTCertificateWithName retrieves all AWSIoTCertificate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIoTCertificateWithName(name string) (AWSIoTCertificate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIoTCertificate: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::Certificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTCertificate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIoTCertificate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-policy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-policy.go new file mode 100644 index 0000000000..5e7c17170d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-policy.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIoTPolicy AWS CloudFormation Resource (AWS::IoT::Policy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html +type AWSIoTPolicy struct { + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // PolicyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-policyname + PolicyName string `json:"PolicyName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTPolicy) AWSCloudFormationType() string { + return "AWS::IoT::Policy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIoTPolicy) MarshalJSON() ([]byte, error) { + type Properties AWSIoTPolicy + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIoTPolicy) UnmarshalJSON(b []byte) error { + type Properties AWSIoTPolicy + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIoTPolicy(*res.Properties) + } + + return nil +} + +// GetAllAWSIoTPolicyResources retrieves all AWSIoTPolicy items from an AWS CloudFormation template +func (t *Template) GetAllAWSIoTPolicyResources() map[string]AWSIoTPolicy { + results := map[string]AWSIoTPolicy{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIoTPolicy: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::Policy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTPolicy + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIoTPolicyWithName retrieves all AWSIoTPolicy items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIoTPolicyWithName(name string) (AWSIoTPolicy, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIoTPolicy: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::Policy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTPolicy + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIoTPolicy{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-policyprincipalattachment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-policyprincipalattachment.go new file mode 100644 index 0000000000..c454a42028 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-policyprincipalattachment.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIoTPolicyPrincipalAttachment AWS CloudFormation Resource (AWS::IoT::PolicyPrincipalAttachment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policyprincipalattachment.html +type AWSIoTPolicyPrincipalAttachment struct { + + // PolicyName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policyprincipalattachment.html#cfn-iot-policyprincipalattachment-policyname + PolicyName string `json:"PolicyName,omitempty"` + + // Principal AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policyprincipalattachment.html#cfn-iot-policyprincipalattachment-principal + Principal string `json:"Principal,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTPolicyPrincipalAttachment) AWSCloudFormationType() string { + return "AWS::IoT::PolicyPrincipalAttachment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTPolicyPrincipalAttachment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIoTPolicyPrincipalAttachment) MarshalJSON() ([]byte, error) { + type Properties AWSIoTPolicyPrincipalAttachment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIoTPolicyPrincipalAttachment) UnmarshalJSON(b []byte) error { + type Properties AWSIoTPolicyPrincipalAttachment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIoTPolicyPrincipalAttachment(*res.Properties) + } + + return nil +} + +// GetAllAWSIoTPolicyPrincipalAttachmentResources retrieves all AWSIoTPolicyPrincipalAttachment items from an AWS CloudFormation template +func (t *Template) GetAllAWSIoTPolicyPrincipalAttachmentResources() map[string]AWSIoTPolicyPrincipalAttachment { + results := map[string]AWSIoTPolicyPrincipalAttachment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIoTPolicyPrincipalAttachment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::PolicyPrincipalAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTPolicyPrincipalAttachment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIoTPolicyPrincipalAttachmentWithName retrieves all AWSIoTPolicyPrincipalAttachment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIoTPolicyPrincipalAttachmentWithName(name string) (AWSIoTPolicyPrincipalAttachment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIoTPolicyPrincipalAttachment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::PolicyPrincipalAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTPolicyPrincipalAttachment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIoTPolicyPrincipalAttachment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thing.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thing.go new file mode 100644 index 0000000000..5d8ffe0971 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thing.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIoTThing AWS CloudFormation Resource (AWS::IoT::Thing) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-thing.html +type AWSIoTThing struct { + + // AttributePayload AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-thing.html#cfn-iot-thing-attributepayload + AttributePayload *AWSIoTThing_AttributePayload `json:"AttributePayload,omitempty"` + + // ThingName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-thing.html#cfn-iot-thing-thingname + ThingName string `json:"ThingName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTThing) AWSCloudFormationType() string { + return "AWS::IoT::Thing" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTThing) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIoTThing) MarshalJSON() ([]byte, error) { + type Properties AWSIoTThing + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIoTThing) UnmarshalJSON(b []byte) error { + type Properties AWSIoTThing + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIoTThing(*res.Properties) + } + + return nil +} + +// GetAllAWSIoTThingResources retrieves all AWSIoTThing items from an AWS CloudFormation template +func (t *Template) GetAllAWSIoTThingResources() map[string]AWSIoTThing { + results := map[string]AWSIoTThing{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIoTThing: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::Thing" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTThing + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIoTThingWithName retrieves all AWSIoTThing items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIoTThingWithName(name string) (AWSIoTThing, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIoTThing: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::Thing" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTThing + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIoTThing{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thing_attributepayload.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thing_attributepayload.go new file mode 100644 index 0000000000..42d7e2437f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thing_attributepayload.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSIoTThing_AttributePayload AWS CloudFormation Resource (AWS::IoT::Thing.AttributePayload) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-thing-attributepayload.html +type AWSIoTThing_AttributePayload struct { + + // Attributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-thing-attributepayload.html#cfn-iot-thing-attributepayload-attributes + Attributes map[string]string `json:"Attributes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTThing_AttributePayload) AWSCloudFormationType() string { + return "AWS::IoT::Thing.AttributePayload" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTThing_AttributePayload) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thingprincipalattachment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thingprincipalattachment.go new file mode 100644 index 0000000000..50ff8dabaa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thingprincipalattachment.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIoTThingPrincipalAttachment AWS CloudFormation Resource (AWS::IoT::ThingPrincipalAttachment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-thingprincipalattachment.html +type AWSIoTThingPrincipalAttachment struct { + + // Principal AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-thingprincipalattachment.html#cfn-iot-thingprincipalattachment-principal + Principal string `json:"Principal,omitempty"` + + // ThingName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-thingprincipalattachment.html#cfn-iot-thingprincipalattachment-thingname + ThingName string `json:"ThingName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTThingPrincipalAttachment) AWSCloudFormationType() string { + return "AWS::IoT::ThingPrincipalAttachment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTThingPrincipalAttachment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIoTThingPrincipalAttachment) MarshalJSON() ([]byte, error) { + type Properties AWSIoTThingPrincipalAttachment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIoTThingPrincipalAttachment) UnmarshalJSON(b []byte) error { + type Properties AWSIoTThingPrincipalAttachment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIoTThingPrincipalAttachment(*res.Properties) + } + + return nil +} + +// GetAllAWSIoTThingPrincipalAttachmentResources retrieves all AWSIoTThingPrincipalAttachment items from an AWS CloudFormation template +func (t *Template) GetAllAWSIoTThingPrincipalAttachmentResources() map[string]AWSIoTThingPrincipalAttachment { + results := map[string]AWSIoTThingPrincipalAttachment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIoTThingPrincipalAttachment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::ThingPrincipalAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTThingPrincipalAttachment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIoTThingPrincipalAttachmentWithName retrieves all AWSIoTThingPrincipalAttachment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIoTThingPrincipalAttachmentWithName(name string) (AWSIoTThingPrincipalAttachment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIoTThingPrincipalAttachment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::ThingPrincipalAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTThingPrincipalAttachment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIoTThingPrincipalAttachment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule.go new file mode 100644 index 0000000000..ae60cd552b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIoTTopicRule AWS CloudFormation Resource (AWS::IoT::TopicRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-topicrule.html +type AWSIoTTopicRule struct { + + // RuleName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-topicrule.html#cfn-iot-topicrule-rulename + RuleName string `json:"RuleName,omitempty"` + + // TopicRulePayload AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-topicrule.html#cfn-iot-topicrule-topicrulepayload + TopicRulePayload *AWSIoTTopicRule_TopicRulePayload `json:"TopicRulePayload,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSIoTTopicRule) MarshalJSON() ([]byte, error) { + type Properties AWSIoTTopicRule + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIoTTopicRule) UnmarshalJSON(b []byte) error { + type Properties AWSIoTTopicRule + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSIoTTopicRule(*res.Properties) + } + + return nil +} + +// GetAllAWSIoTTopicRuleResources retrieves all AWSIoTTopicRule items from an AWS CloudFormation template +func (t *Template) GetAllAWSIoTTopicRuleResources() map[string]AWSIoTTopicRule { + results := map[string]AWSIoTTopicRule{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIoTTopicRule: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::TopicRule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTTopicRule + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIoTTopicRuleWithName retrieves all AWSIoTTopicRule items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIoTTopicRuleWithName(name string) (AWSIoTTopicRule, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIoTTopicRule: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::IoT::TopicRule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIoTTopicRule + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIoTTopicRule{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_action.go new file mode 100644 index 0000000000..fce5b1a43f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_action.go @@ -0,0 +1,71 @@ +package cloudformation + +// AWSIoTTopicRule_Action AWS CloudFormation Resource (AWS::IoT::TopicRule.Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html +type AWSIoTTopicRule_Action struct { + + // CloudwatchAlarm AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-cloudwatchalarm + CloudwatchAlarm *AWSIoTTopicRule_CloudwatchAlarmAction `json:"CloudwatchAlarm,omitempty"` + + // CloudwatchMetric AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-cloudwatchmetric + CloudwatchMetric *AWSIoTTopicRule_CloudwatchMetricAction `json:"CloudwatchMetric,omitempty"` + + // DynamoDB AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-dynamodb + DynamoDB *AWSIoTTopicRule_DynamoDBAction `json:"DynamoDB,omitempty"` + + // Elasticsearch AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-elasticsearch + Elasticsearch *AWSIoTTopicRule_ElasticsearchAction `json:"Elasticsearch,omitempty"` + + // Firehose AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-firehose + Firehose *AWSIoTTopicRule_FirehoseAction `json:"Firehose,omitempty"` + + // Kinesis AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-kinesis + Kinesis *AWSIoTTopicRule_KinesisAction `json:"Kinesis,omitempty"` + + // Lambda AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-lambda + Lambda *AWSIoTTopicRule_LambdaAction `json:"Lambda,omitempty"` + + // Republish AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-republish + Republish *AWSIoTTopicRule_RepublishAction `json:"Republish,omitempty"` + + // S3 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-s3 + S3 *AWSIoTTopicRule_S3Action `json:"S3,omitempty"` + + // Sns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-sns + Sns *AWSIoTTopicRule_SnsAction `json:"Sns,omitempty"` + + // Sqs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-actions.html#cfn-iot-action-sqs + Sqs *AWSIoTTopicRule_SqsAction `json:"Sqs,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_Action) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.Action" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_Action) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_cloudwatchalarmaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_cloudwatchalarmaction.go new file mode 100644 index 0000000000..e0e5b81e27 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_cloudwatchalarmaction.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSIoTTopicRule_CloudwatchAlarmAction AWS CloudFormation Resource (AWS::IoT::TopicRule.CloudwatchAlarmAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchalarm.html +type AWSIoTTopicRule_CloudwatchAlarmAction struct { + + // AlarmName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchalarm.html#cfn-iot-cloudwatchalarm-alarmname + AlarmName string `json:"AlarmName,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchalarm.html#cfn-iot-cloudwatchalarm-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // StateReason AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchalarm.html#cfn-iot-cloudwatchalarm-statereason + StateReason string `json:"StateReason,omitempty"` + + // StateValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchalarm.html#cfn-iot-cloudwatchalarm-statevalue + StateValue string `json:"StateValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_CloudwatchAlarmAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.CloudwatchAlarmAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_CloudwatchAlarmAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_cloudwatchmetricaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_cloudwatchmetricaction.go new file mode 100644 index 0000000000..5bab4dbe92 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_cloudwatchmetricaction.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSIoTTopicRule_CloudwatchMetricAction AWS CloudFormation Resource (AWS::IoT::TopicRule.CloudwatchMetricAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchmetric.html +type AWSIoTTopicRule_CloudwatchMetricAction struct { + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchmetric.html#cfn-iot-cloudwatchmetric-metricname + MetricName string `json:"MetricName,omitempty"` + + // MetricNamespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchmetric.html#cfn-iot-cloudwatchmetric-metricnamespace + MetricNamespace string `json:"MetricNamespace,omitempty"` + + // MetricTimestamp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchmetric.html#cfn-iot-cloudwatchmetric-metrictimestamp + MetricTimestamp string `json:"MetricTimestamp,omitempty"` + + // MetricUnit AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchmetric.html#cfn-iot-cloudwatchmetric-metricunit + MetricUnit string `json:"MetricUnit,omitempty"` + + // MetricValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchmetric.html#cfn-iot-cloudwatchmetric-metricvalue + MetricValue string `json:"MetricValue,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-cloudwatchmetric.html#cfn-iot-cloudwatchmetric-rolearn + RoleArn string `json:"RoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_CloudwatchMetricAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.CloudwatchMetricAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_CloudwatchMetricAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_dynamodbaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_dynamodbaction.go new file mode 100644 index 0000000000..fbc55a0f81 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_dynamodbaction.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSIoTTopicRule_DynamoDBAction AWS CloudFormation Resource (AWS::IoT::TopicRule.DynamoDBAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-dynamodb.html +type AWSIoTTopicRule_DynamoDBAction struct { + + // HashKeyField AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-dynamodb.html#cfn-iot-dynamodb-hashkeyfield + HashKeyField string `json:"HashKeyField,omitempty"` + + // HashKeyValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-dynamodb.html#cfn-iot-dynamodb-hashkeyvalue + HashKeyValue string `json:"HashKeyValue,omitempty"` + + // PayloadField AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-dynamodb.html#cfn-iot-dynamodb-payloadfield + PayloadField string `json:"PayloadField,omitempty"` + + // RangeKeyField AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-dynamodb.html#cfn-iot-dynamodb-rangekeyfield + RangeKeyField string `json:"RangeKeyField,omitempty"` + + // RangeKeyValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-dynamodb.html#cfn-iot-dynamodb-rangekeyvalue + RangeKeyValue string `json:"RangeKeyValue,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-dynamodb.html#cfn-iot-dynamodb-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // TableName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-dynamodb.html#cfn-iot-dynamodb-tablename + TableName string `json:"TableName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_DynamoDBAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.DynamoDBAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_DynamoDBAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_elasticsearchaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_elasticsearchaction.go new file mode 100644 index 0000000000..c65d2e41ea --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_elasticsearchaction.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSIoTTopicRule_ElasticsearchAction AWS CloudFormation Resource (AWS::IoT::TopicRule.ElasticsearchAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-elasticsearch.html +type AWSIoTTopicRule_ElasticsearchAction struct { + + // Endpoint AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-elasticsearch.html#cfn-iot-elasticsearch-endpoint + Endpoint string `json:"Endpoint,omitempty"` + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-elasticsearch.html#cfn-iot-elasticsearch-id + Id string `json:"Id,omitempty"` + + // Index AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-elasticsearch.html#cfn-iot-elasticsearch-index + Index string `json:"Index,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-elasticsearch.html#cfn-iot-elasticsearch-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-elasticsearch.html#cfn-iot-elasticsearch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_ElasticsearchAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.ElasticsearchAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_ElasticsearchAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_firehoseaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_firehoseaction.go new file mode 100644 index 0000000000..8aac0aeb6f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_firehoseaction.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSIoTTopicRule_FirehoseAction AWS CloudFormation Resource (AWS::IoT::TopicRule.FirehoseAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-firehose.html +type AWSIoTTopicRule_FirehoseAction struct { + + // DeliveryStreamName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-firehose.html#cfn-iot-firehose-deliverystreamname + DeliveryStreamName string `json:"DeliveryStreamName,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-firehose.html#cfn-iot-firehose-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // Separator AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-firehose.html#cfn-iot-firehose-separator + Separator string `json:"Separator,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_FirehoseAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.FirehoseAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_FirehoseAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_kinesisaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_kinesisaction.go new file mode 100644 index 0000000000..2bf6393723 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_kinesisaction.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSIoTTopicRule_KinesisAction AWS CloudFormation Resource (AWS::IoT::TopicRule.KinesisAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-kinesis.html +type AWSIoTTopicRule_KinesisAction struct { + + // PartitionKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-kinesis.html#cfn-iot-kinesis-partitionkey + PartitionKey string `json:"PartitionKey,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-kinesis.html#cfn-iot-kinesis-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // StreamName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-kinesis.html#cfn-iot-kinesis-streamname + StreamName string `json:"StreamName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_KinesisAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.KinesisAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_KinesisAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_lambdaaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_lambdaaction.go new file mode 100644 index 0000000000..3e37e98d53 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_lambdaaction.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSIoTTopicRule_LambdaAction AWS CloudFormation Resource (AWS::IoT::TopicRule.LambdaAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-lambda.html +type AWSIoTTopicRule_LambdaAction struct { + + // FunctionArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-lambda.html#cfn-iot-lambda-functionarn + FunctionArn string `json:"FunctionArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_LambdaAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.LambdaAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_LambdaAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_republishaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_republishaction.go new file mode 100644 index 0000000000..507d4cf696 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_republishaction.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSIoTTopicRule_RepublishAction AWS CloudFormation Resource (AWS::IoT::TopicRule.RepublishAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-republish.html +type AWSIoTTopicRule_RepublishAction struct { + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-republish.html#cfn-iot-republish-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // Topic AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-republish.html#cfn-iot-republish-topic + Topic string `json:"Topic,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_RepublishAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.RepublishAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_RepublishAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_s3action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_s3action.go new file mode 100644 index 0000000000..02965d8012 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_s3action.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSIoTTopicRule_S3Action AWS CloudFormation Resource (AWS::IoT::TopicRule.S3Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-s3.html +type AWSIoTTopicRule_S3Action struct { + + // BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-s3.html#cfn-iot-s3-bucketname + BucketName string `json:"BucketName,omitempty"` + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-s3.html#cfn-iot-s3-key + Key string `json:"Key,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-s3.html#cfn-iot-s3-rolearn + RoleArn string `json:"RoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_S3Action) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.S3Action" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_S3Action) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_snsaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_snsaction.go new file mode 100644 index 0000000000..111583a010 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_snsaction.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSIoTTopicRule_SnsAction AWS CloudFormation Resource (AWS::IoT::TopicRule.SnsAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-sns.html +type AWSIoTTopicRule_SnsAction struct { + + // MessageFormat AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-sns.html#cfn-iot-sns-snsaction + MessageFormat string `json:"MessageFormat,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-sns.html#cfn-iot-sns-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // TargetArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-sns.html#cfn-iot-sns-targetarn + TargetArn string `json:"TargetArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_SnsAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.SnsAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_SnsAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_sqsaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_sqsaction.go new file mode 100644 index 0000000000..1ad3e800bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_sqsaction.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSIoTTopicRule_SqsAction AWS CloudFormation Resource (AWS::IoT::TopicRule.SqsAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-sqs.html +type AWSIoTTopicRule_SqsAction struct { + + // QueueUrl AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-sqs.html#cfn-iot-sqs-queueurl + QueueUrl string `json:"QueueUrl,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-sqs.html#cfn-iot-sqs-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // UseBase64 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-sqs.html#cfn-iot-sqs-usebase64 + UseBase64 bool `json:"UseBase64,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_SqsAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.SqsAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_SqsAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_topicrulepayload.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_topicrulepayload.go new file mode 100644 index 0000000000..3a383d9770 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_topicrulepayload.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSIoTTopicRule_TopicRulePayload AWS CloudFormation Resource (AWS::IoT::TopicRule.TopicRulePayload) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrulepayload.html +type AWSIoTTopicRule_TopicRulePayload struct { + + // Actions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrulepayload.html#cfn-iot-topicrulepayload-actions + Actions []AWSIoTTopicRule_Action `json:"Actions,omitempty"` + + // AwsIotSqlVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrulepayload.html#cfn-iot-topicrulepayload-awsiotsqlversion + AwsIotSqlVersion string `json:"AwsIotSqlVersion,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrulepayload.html#cfn-iot-topicrulepayload-description + Description string `json:"Description,omitempty"` + + // RuleDisabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrulepayload.html#cfn-iot-topicrulepayload-ruledisabled + RuleDisabled bool `json:"RuleDisabled,omitempty"` + + // Sql AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrulepayload.html#cfn-iot-topicrulepayload-sql + Sql string `json:"Sql,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_TopicRulePayload) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.TopicRulePayload" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSIoTTopicRule_TopicRulePayload) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesis-stream.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesis-stream.go new file mode 100644 index 0000000000..be386ad557 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesis-stream.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSKinesisStream AWS CloudFormation Resource (AWS::Kinesis::Stream) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesis-stream.html +type AWSKinesisStream struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesis-stream.html#cfn-kinesis-stream-name + Name string `json:"Name,omitempty"` + + // RetentionPeriodHours AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesis-stream.html#cfn-kinesis-stream-retentionperiodhours + RetentionPeriodHours int `json:"RetentionPeriodHours,omitempty"` + + // ShardCount AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesis-stream.html#cfn-kinesis-stream-shardcount + ShardCount int `json:"ShardCount,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesis-stream.html#cfn-kinesis-stream-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisStream) AWSCloudFormationType() string { + return "AWS::Kinesis::Stream" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisStream) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSKinesisStream) MarshalJSON() ([]byte, error) { + type Properties AWSKinesisStream + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSKinesisStream) UnmarshalJSON(b []byte) error { + type Properties AWSKinesisStream + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSKinesisStream(*res.Properties) + } + + return nil +} + +// GetAllAWSKinesisStreamResources retrieves all AWSKinesisStream items from an AWS CloudFormation template +func (t *Template) GetAllAWSKinesisStreamResources() map[string]AWSKinesisStream { + results := map[string]AWSKinesisStream{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSKinesisStream: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Kinesis::Stream" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisStream + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSKinesisStreamWithName retrieves all AWSKinesisStream items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSKinesisStreamWithName(name string) (AWSKinesisStream, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSKinesisStream: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Kinesis::Stream" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisStream + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSKinesisStream{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application.go new file mode 100644 index 0000000000..bbbb11f669 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSKinesisAnalyticsApplication AWS CloudFormation Resource (AWS::KinesisAnalytics::Application) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-application.html +type AWSKinesisAnalyticsApplication struct { + + // ApplicationCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-application.html#cfn-kinesisanalytics-application-applicationcode + ApplicationCode string `json:"ApplicationCode,omitempty"` + + // ApplicationDescription AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-application.html#cfn-kinesisanalytics-application-applicationdescription + ApplicationDescription string `json:"ApplicationDescription,omitempty"` + + // ApplicationName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-application.html#cfn-kinesisanalytics-application-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` + + // Inputs AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-application.html#cfn-kinesisanalytics-application-inputs + Inputs []AWSKinesisAnalyticsApplication_Input `json:"Inputs,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSKinesisAnalyticsApplication) MarshalJSON() ([]byte, error) { + type Properties AWSKinesisAnalyticsApplication + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSKinesisAnalyticsApplication) UnmarshalJSON(b []byte) error { + type Properties AWSKinesisAnalyticsApplication + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSKinesisAnalyticsApplication(*res.Properties) + } + + return nil +} + +// GetAllAWSKinesisAnalyticsApplicationResources retrieves all AWSKinesisAnalyticsApplication items from an AWS CloudFormation template +func (t *Template) GetAllAWSKinesisAnalyticsApplicationResources() map[string]AWSKinesisAnalyticsApplication { + results := map[string]AWSKinesisAnalyticsApplication{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSKinesisAnalyticsApplication: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KinesisAnalytics::Application" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisAnalyticsApplication + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSKinesisAnalyticsApplicationWithName retrieves all AWSKinesisAnalyticsApplication items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSKinesisAnalyticsApplicationWithName(name string) (AWSKinesisAnalyticsApplication, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSKinesisAnalyticsApplication: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KinesisAnalytics::Application" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisAnalyticsApplication + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSKinesisAnalyticsApplication{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_csvmappingparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_csvmappingparameters.go new file mode 100644 index 0000000000..1d385a4a68 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_csvmappingparameters.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_CSVMappingParameters AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.CSVMappingParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-csvmappingparameters.html +type AWSKinesisAnalyticsApplication_CSVMappingParameters struct { + + // RecordColumnDelimiter AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-csvmappingparameters.html#cfn-kinesisanalytics-application-csvmappingparameters-recordcolumndelimiter + RecordColumnDelimiter string `json:"RecordColumnDelimiter,omitempty"` + + // RecordRowDelimiter AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-csvmappingparameters.html#cfn-kinesisanalytics-application-csvmappingparameters-recordrowdelimiter + RecordRowDelimiter string `json:"RecordRowDelimiter,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_CSVMappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.CSVMappingParameters" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_CSVMappingParameters) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_input.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_input.go new file mode 100644 index 0000000000..748d2700ab --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_input.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_Input AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.Input) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-input.html +type AWSKinesisAnalyticsApplication_Input struct { + + // InputParallelism AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-input.html#cfn-kinesisanalytics-application-input-inputparallelism + InputParallelism *AWSKinesisAnalyticsApplication_InputParallelism `json:"InputParallelism,omitempty"` + + // InputSchema AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-input.html#cfn-kinesisanalytics-application-input-inputschema + InputSchema *AWSKinesisAnalyticsApplication_InputSchema `json:"InputSchema,omitempty"` + + // KinesisFirehoseInput AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-input.html#cfn-kinesisanalytics-application-input-kinesisfirehoseinput + KinesisFirehoseInput *AWSKinesisAnalyticsApplication_KinesisFirehoseInput `json:"KinesisFirehoseInput,omitempty"` + + // KinesisStreamsInput AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-input.html#cfn-kinesisanalytics-application-input-kinesisstreamsinput + KinesisStreamsInput *AWSKinesisAnalyticsApplication_KinesisStreamsInput `json:"KinesisStreamsInput,omitempty"` + + // NamePrefix AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-input.html#cfn-kinesisanalytics-application-input-nameprefix + NamePrefix string `json:"NamePrefix,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_Input) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.Input" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_Input) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputparallelism.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputparallelism.go new file mode 100644 index 0000000000..826a8205a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputparallelism.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_InputParallelism AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.InputParallelism) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputparallelism.html +type AWSKinesisAnalyticsApplication_InputParallelism struct { + + // Count AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputparallelism.html#cfn-kinesisanalytics-application-inputparallelism-count + Count int `json:"Count,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_InputParallelism) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.InputParallelism" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_InputParallelism) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputschema.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputschema.go new file mode 100644 index 0000000000..ac86d55ebb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputschema.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_InputSchema AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.InputSchema) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputschema.html +type AWSKinesisAnalyticsApplication_InputSchema struct { + + // RecordColumns AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputschema.html#cfn-kinesisanalytics-application-inputschema-recordcolumns + RecordColumns []AWSKinesisAnalyticsApplication_RecordColumn `json:"RecordColumns,omitempty"` + + // RecordEncoding AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputschema.html#cfn-kinesisanalytics-application-inputschema-recordencoding + RecordEncoding string `json:"RecordEncoding,omitempty"` + + // RecordFormat AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputschema.html#cfn-kinesisanalytics-application-inputschema-recordformat + RecordFormat *AWSKinesisAnalyticsApplication_RecordFormat `json:"RecordFormat,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_InputSchema) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.InputSchema" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_InputSchema) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_jsonmappingparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_jsonmappingparameters.go new file mode 100644 index 0000000000..104306dc38 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_jsonmappingparameters.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_JSONMappingParameters AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.JSONMappingParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-jsonmappingparameters.html +type AWSKinesisAnalyticsApplication_JSONMappingParameters struct { + + // RecordRowPath AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-jsonmappingparameters.html#cfn-kinesisanalytics-application-jsonmappingparameters-recordrowpath + RecordRowPath string `json:"RecordRowPath,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_JSONMappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.JSONMappingParameters" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_JSONMappingParameters) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_kinesisfirehoseinput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_kinesisfirehoseinput.go new file mode 100644 index 0000000000..fff4f71dc0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_kinesisfirehoseinput.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_KinesisFirehoseInput AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.KinesisFirehoseInput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-kinesisfirehoseinput.html +type AWSKinesisAnalyticsApplication_KinesisFirehoseInput struct { + + // ResourceARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-kinesisfirehoseinput.html#cfn-kinesisanalytics-application-kinesisfirehoseinput-resourcearn + ResourceARN string `json:"ResourceARN,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-kinesisfirehoseinput.html#cfn-kinesisanalytics-application-kinesisfirehoseinput-rolearn + RoleARN string `json:"RoleARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_KinesisFirehoseInput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.KinesisFirehoseInput" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_KinesisFirehoseInput) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_kinesisstreamsinput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_kinesisstreamsinput.go new file mode 100644 index 0000000000..443e9eed29 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_kinesisstreamsinput.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_KinesisStreamsInput AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.KinesisStreamsInput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-kinesisstreamsinput.html +type AWSKinesisAnalyticsApplication_KinesisStreamsInput struct { + + // ResourceARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-kinesisstreamsinput.html#cfn-kinesisanalytics-application-kinesisstreamsinput-resourcearn + ResourceARN string `json:"ResourceARN,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-kinesisstreamsinput.html#cfn-kinesisanalytics-application-kinesisstreamsinput-rolearn + RoleARN string `json:"RoleARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_KinesisStreamsInput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.KinesisStreamsInput" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_KinesisStreamsInput) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_mappingparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_mappingparameters.go new file mode 100644 index 0000000000..51324a52d3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_mappingparameters.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_MappingParameters AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.MappingParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-mappingparameters.html +type AWSKinesisAnalyticsApplication_MappingParameters struct { + + // CSVMappingParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-mappingparameters.html#cfn-kinesisanalytics-application-mappingparameters-csvmappingparameters + CSVMappingParameters *AWSKinesisAnalyticsApplication_CSVMappingParameters `json:"CSVMappingParameters,omitempty"` + + // JSONMappingParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-mappingparameters.html#cfn-kinesisanalytics-application-mappingparameters-jsonmappingparameters + JSONMappingParameters *AWSKinesisAnalyticsApplication_JSONMappingParameters `json:"JSONMappingParameters,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_MappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.MappingParameters" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_MappingParameters) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_recordcolumn.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_recordcolumn.go new file mode 100644 index 0000000000..ceb5c056aa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_recordcolumn.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_RecordColumn AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.RecordColumn) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-recordcolumn.html +type AWSKinesisAnalyticsApplication_RecordColumn struct { + + // Mapping AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-recordcolumn.html#cfn-kinesisanalytics-application-recordcolumn-mapping + Mapping string `json:"Mapping,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-recordcolumn.html#cfn-kinesisanalytics-application-recordcolumn-name + Name string `json:"Name,omitempty"` + + // SqlType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-recordcolumn.html#cfn-kinesisanalytics-application-recordcolumn-sqltype + SqlType string `json:"SqlType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_RecordColumn) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.RecordColumn" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_RecordColumn) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_recordformat.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_recordformat.go new file mode 100644 index 0000000000..b7bdf913ba --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_recordformat.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_RecordFormat AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.RecordFormat) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-recordformat.html +type AWSKinesisAnalyticsApplication_RecordFormat struct { + + // MappingParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-recordformat.html#cfn-kinesisanalytics-application-recordformat-mappingparameters + MappingParameters *AWSKinesisAnalyticsApplication_MappingParameters `json:"MappingParameters,omitempty"` + + // RecordFormatType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-recordformat.html#cfn-kinesisanalytics-application-recordformat-recordformattype + RecordFormatType string `json:"RecordFormatType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_RecordFormat) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.RecordFormat" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplication_RecordFormat) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput.go new file mode 100644 index 0000000000..372e244725 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSKinesisAnalyticsApplicationOutput AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationOutput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-applicationoutput.html +type AWSKinesisAnalyticsApplicationOutput struct { + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-applicationoutput.html#cfn-kinesisanalytics-applicationoutput-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` + + // Output AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-applicationoutput.html#cfn-kinesisanalytics-applicationoutput-output + Output *AWSKinesisAnalyticsApplicationOutput_Output `json:"Output,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationOutput) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSKinesisAnalyticsApplicationOutput) MarshalJSON() ([]byte, error) { + type Properties AWSKinesisAnalyticsApplicationOutput + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSKinesisAnalyticsApplicationOutput) UnmarshalJSON(b []byte) error { + type Properties AWSKinesisAnalyticsApplicationOutput + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSKinesisAnalyticsApplicationOutput(*res.Properties) + } + + return nil +} + +// GetAllAWSKinesisAnalyticsApplicationOutputResources retrieves all AWSKinesisAnalyticsApplicationOutput items from an AWS CloudFormation template +func (t *Template) GetAllAWSKinesisAnalyticsApplicationOutputResources() map[string]AWSKinesisAnalyticsApplicationOutput { + results := map[string]AWSKinesisAnalyticsApplicationOutput{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSKinesisAnalyticsApplicationOutput: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KinesisAnalytics::ApplicationOutput" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisAnalyticsApplicationOutput + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSKinesisAnalyticsApplicationOutputWithName retrieves all AWSKinesisAnalyticsApplicationOutput items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSKinesisAnalyticsApplicationOutputWithName(name string) (AWSKinesisAnalyticsApplicationOutput, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSKinesisAnalyticsApplicationOutput: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KinesisAnalytics::ApplicationOutput" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisAnalyticsApplicationOutput + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSKinesisAnalyticsApplicationOutput{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_destinationschema.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_destinationschema.go new file mode 100644 index 0000000000..889c5939f0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_destinationschema.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationOutput_DestinationSchema AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationOutput.DestinationSchema) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-destinationschema.html +type AWSKinesisAnalyticsApplicationOutput_DestinationSchema struct { + + // RecordFormatType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-destinationschema.html#cfn-kinesisanalytics-applicationoutput-destinationschema-recordformattype + RecordFormatType string `json:"RecordFormatType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_DestinationSchema) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.DestinationSchema" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationOutput_DestinationSchema) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_kinesisfirehoseoutput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_kinesisfirehoseoutput.go new file mode 100644 index 0000000000..719e19ac75 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_kinesisfirehoseoutput.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationOutput_KinesisFirehoseOutput AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationOutput.KinesisFirehoseOutput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-kinesisfirehoseoutput.html +type AWSKinesisAnalyticsApplicationOutput_KinesisFirehoseOutput struct { + + // ResourceARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-kinesisfirehoseoutput.html#cfn-kinesisanalytics-applicationoutput-kinesisfirehoseoutput-resourcearn + ResourceARN string `json:"ResourceARN,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-kinesisfirehoseoutput.html#cfn-kinesisanalytics-applicationoutput-kinesisfirehoseoutput-rolearn + RoleARN string `json:"RoleARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_KinesisFirehoseOutput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.KinesisFirehoseOutput" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationOutput_KinesisFirehoseOutput) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_kinesisstreamsoutput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_kinesisstreamsoutput.go new file mode 100644 index 0000000000..c1c1ba2390 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_kinesisstreamsoutput.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationOutput_KinesisStreamsOutput AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationOutput.KinesisStreamsOutput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-kinesisstreamsoutput.html +type AWSKinesisAnalyticsApplicationOutput_KinesisStreamsOutput struct { + + // ResourceARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-kinesisstreamsoutput.html#cfn-kinesisanalytics-applicationoutput-kinesisstreamsoutput-resourcearn + ResourceARN string `json:"ResourceARN,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-kinesisstreamsoutput.html#cfn-kinesisanalytics-applicationoutput-kinesisstreamsoutput-rolearn + RoleARN string `json:"RoleARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_KinesisStreamsOutput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.KinesisStreamsOutput" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationOutput_KinesisStreamsOutput) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_output.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_output.go new file mode 100644 index 0000000000..c853815cd3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_output.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationOutput_Output AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationOutput.Output) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-output.html +type AWSKinesisAnalyticsApplicationOutput_Output struct { + + // DestinationSchema AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-output.html#cfn-kinesisanalytics-applicationoutput-output-destinationschema + DestinationSchema *AWSKinesisAnalyticsApplicationOutput_DestinationSchema `json:"DestinationSchema,omitempty"` + + // KinesisFirehoseOutput AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-output.html#cfn-kinesisanalytics-applicationoutput-output-kinesisfirehoseoutput + KinesisFirehoseOutput *AWSKinesisAnalyticsApplicationOutput_KinesisFirehoseOutput `json:"KinesisFirehoseOutput,omitempty"` + + // KinesisStreamsOutput AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-output.html#cfn-kinesisanalytics-applicationoutput-output-kinesisstreamsoutput + KinesisStreamsOutput *AWSKinesisAnalyticsApplicationOutput_KinesisStreamsOutput `json:"KinesisStreamsOutput,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-output.html#cfn-kinesisanalytics-applicationoutput-output-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_Output) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.Output" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationOutput_Output) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource.go new file mode 100644 index 0000000000..85a54da2c1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSKinesisAnalyticsApplicationReferenceDataSource AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-applicationreferencedatasource.html +type AWSKinesisAnalyticsApplicationReferenceDataSource struct { + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-applicationreferencedatasource.html#cfn-kinesisanalytics-applicationreferencedatasource-applicationname + ApplicationName string `json:"ApplicationName,omitempty"` + + // ReferenceDataSource AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-applicationreferencedatasource.html#cfn-kinesisanalytics-applicationreferencedatasource-referencedatasource + ReferenceDataSource *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceDataSource `json:"ReferenceDataSource,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource) MarshalJSON() ([]byte, error) { + type Properties AWSKinesisAnalyticsApplicationReferenceDataSource + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource) UnmarshalJSON(b []byte) error { + type Properties AWSKinesisAnalyticsApplicationReferenceDataSource + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSKinesisAnalyticsApplicationReferenceDataSource(*res.Properties) + } + + return nil +} + +// GetAllAWSKinesisAnalyticsApplicationReferenceDataSourceResources retrieves all AWSKinesisAnalyticsApplicationReferenceDataSource items from an AWS CloudFormation template +func (t *Template) GetAllAWSKinesisAnalyticsApplicationReferenceDataSourceResources() map[string]AWSKinesisAnalyticsApplicationReferenceDataSource { + results := map[string]AWSKinesisAnalyticsApplicationReferenceDataSource{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSKinesisAnalyticsApplicationReferenceDataSource: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KinesisAnalytics::ApplicationReferenceDataSource" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisAnalyticsApplicationReferenceDataSource + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSKinesisAnalyticsApplicationReferenceDataSourceWithName retrieves all AWSKinesisAnalyticsApplicationReferenceDataSource items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSKinesisAnalyticsApplicationReferenceDataSourceWithName(name string) (AWSKinesisAnalyticsApplicationReferenceDataSource, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSKinesisAnalyticsApplicationReferenceDataSource: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KinesisAnalytics::ApplicationReferenceDataSource" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisAnalyticsApplicationReferenceDataSource + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSKinesisAnalyticsApplicationReferenceDataSource{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_csvmappingparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_csvmappingparameters.go new file mode 100644 index 0000000000..8ef7f05366 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_csvmappingparameters.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationReferenceDataSource_CSVMappingParameters AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource.CSVMappingParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-csvmappingparameters.html +type AWSKinesisAnalyticsApplicationReferenceDataSource_CSVMappingParameters struct { + + // RecordColumnDelimiter AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-csvmappingparameters.html#cfn-kinesisanalytics-applicationreferencedatasource-csvmappingparameters-recordcolumndelimiter + RecordColumnDelimiter string `json:"RecordColumnDelimiter,omitempty"` + + // RecordRowDelimiter AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-csvmappingparameters.html#cfn-kinesisanalytics-applicationreferencedatasource-csvmappingparameters-recordrowdelimiter + RecordRowDelimiter string `json:"RecordRowDelimiter,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_CSVMappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.CSVMappingParameters" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_CSVMappingParameters) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_jsonmappingparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_jsonmappingparameters.go new file mode 100644 index 0000000000..7edcc02b9f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_jsonmappingparameters.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationReferenceDataSource_JSONMappingParameters AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource.JSONMappingParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-jsonmappingparameters.html +type AWSKinesisAnalyticsApplicationReferenceDataSource_JSONMappingParameters struct { + + // RecordRowPath AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-jsonmappingparameters.html#cfn-kinesisanalytics-applicationreferencedatasource-jsonmappingparameters-recordrowpath + RecordRowPath string `json:"RecordRowPath,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_JSONMappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.JSONMappingParameters" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_JSONMappingParameters) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_mappingparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_mappingparameters.go new file mode 100644 index 0000000000..adb4caa6c0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_mappingparameters.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationReferenceDataSource_MappingParameters AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource.MappingParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-mappingparameters.html +type AWSKinesisAnalyticsApplicationReferenceDataSource_MappingParameters struct { + + // CSVMappingParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-mappingparameters.html#cfn-kinesisanalytics-applicationreferencedatasource-mappingparameters-csvmappingparameters + CSVMappingParameters *AWSKinesisAnalyticsApplicationReferenceDataSource_CSVMappingParameters `json:"CSVMappingParameters,omitempty"` + + // JSONMappingParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-mappingparameters.html#cfn-kinesisanalytics-applicationreferencedatasource-mappingparameters-jsonmappingparameters + JSONMappingParameters *AWSKinesisAnalyticsApplicationReferenceDataSource_JSONMappingParameters `json:"JSONMappingParameters,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_MappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.MappingParameters" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_MappingParameters) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_recordcolumn.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_recordcolumn.go new file mode 100644 index 0000000000..c7827e42a1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_recordcolumn.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationReferenceDataSource_RecordColumn AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordColumn) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-recordcolumn.html +type AWSKinesisAnalyticsApplicationReferenceDataSource_RecordColumn struct { + + // Mapping AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-recordcolumn.html#cfn-kinesisanalytics-applicationreferencedatasource-recordcolumn-mapping + Mapping string `json:"Mapping,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-recordcolumn.html#cfn-kinesisanalytics-applicationreferencedatasource-recordcolumn-name + Name string `json:"Name,omitempty"` + + // SqlType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-recordcolumn.html#cfn-kinesisanalytics-applicationreferencedatasource-recordcolumn-sqltype + SqlType string `json:"SqlType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordColumn) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordColumn" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordColumn) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_recordformat.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_recordformat.go new file mode 100644 index 0000000000..980754375d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_recordformat.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationReferenceDataSource_RecordFormat AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordFormat) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-recordformat.html +type AWSKinesisAnalyticsApplicationReferenceDataSource_RecordFormat struct { + + // MappingParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-recordformat.html#cfn-kinesisanalytics-applicationreferencedatasource-recordformat-mappingparameters + MappingParameters *AWSKinesisAnalyticsApplicationReferenceDataSource_MappingParameters `json:"MappingParameters,omitempty"` + + // RecordFormatType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-recordformat.html#cfn-kinesisanalytics-applicationreferencedatasource-recordformat-recordformattype + RecordFormatType string `json:"RecordFormatType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordFormat) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordFormat" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordFormat) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referencedatasource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referencedatasource.go new file mode 100644 index 0000000000..43b8b89e4e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referencedatasource.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceDataSource AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceDataSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referencedatasource.html +type AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceDataSource struct { + + // ReferenceSchema AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referencedatasource.html#cfn-kinesisanalytics-applicationreferencedatasource-referencedatasource-referenceschema + ReferenceSchema *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceSchema `json:"ReferenceSchema,omitempty"` + + // S3ReferenceDataSource AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referencedatasource.html#cfn-kinesisanalytics-applicationreferencedatasource-referencedatasource-s3referencedatasource + S3ReferenceDataSource *AWSKinesisAnalyticsApplicationReferenceDataSource_S3ReferenceDataSource `json:"S3ReferenceDataSource,omitempty"` + + // TableName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referencedatasource.html#cfn-kinesisanalytics-applicationreferencedatasource-referencedatasource-tablename + TableName string `json:"TableName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceDataSource) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceDataSource" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceDataSource) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referenceschema.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referenceschema.go new file mode 100644 index 0000000000..66cd5a758b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referenceschema.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceSchema AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceSchema) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referenceschema.html +type AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceSchema struct { + + // RecordColumns AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referenceschema.html#cfn-kinesisanalytics-applicationreferencedatasource-referenceschema-recordcolumns + RecordColumns []AWSKinesisAnalyticsApplicationReferenceDataSource_RecordColumn `json:"RecordColumns,omitempty"` + + // RecordEncoding AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referenceschema.html#cfn-kinesisanalytics-applicationreferencedatasource-referenceschema-recordencoding + RecordEncoding string `json:"RecordEncoding,omitempty"` + + // RecordFormat AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referenceschema.html#cfn-kinesisanalytics-applicationreferencedatasource-referenceschema-recordformat + RecordFormat *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordFormat `json:"RecordFormat,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceSchema) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceSchema" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceSchema) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_s3referencedatasource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_s3referencedatasource.go new file mode 100644 index 0000000000..ad41f5b69b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_s3referencedatasource.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationReferenceDataSource_S3ReferenceDataSource AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationReferenceDataSource.S3ReferenceDataSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-s3referencedatasource.html +type AWSKinesisAnalyticsApplicationReferenceDataSource_S3ReferenceDataSource struct { + + // BucketARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-s3referencedatasource.html#cfn-kinesisanalytics-applicationreferencedatasource-s3referencedatasource-bucketarn + BucketARN string `json:"BucketARN,omitempty"` + + // FileKey AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-s3referencedatasource.html#cfn-kinesisanalytics-applicationreferencedatasource-s3referencedatasource-filekey + FileKey string `json:"FileKey,omitempty"` + + // ReferenceRoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-s3referencedatasource.html#cfn-kinesisanalytics-applicationreferencedatasource-s3referencedatasource-referencerolearn + ReferenceRoleARN string `json:"ReferenceRoleARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_S3ReferenceDataSource) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.S3ReferenceDataSource" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_S3ReferenceDataSource) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream.go new file mode 100644 index 0000000000..6df9ccdf85 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSKinesisFirehoseDeliveryStream AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html +type AWSKinesisFirehoseDeliveryStream struct { + + // DeliveryStreamName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverstream-deliverystreamname + DeliveryStreamName string `json:"DeliveryStreamName,omitempty"` + + // ElasticsearchDestinationConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverstream-elasticsearchdestinationconfiguration + ElasticsearchDestinationConfiguration *AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration `json:"ElasticsearchDestinationConfiguration,omitempty"` + + // RedshiftDestinationConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverystream-redshiftdestinationconfiguration + RedshiftDestinationConfiguration *AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration `json:"RedshiftDestinationConfiguration,omitempty"` + + // S3DestinationConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverystream-s3destinationconfiguration + S3DestinationConfiguration *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration `json:"S3DestinationConfiguration,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSKinesisFirehoseDeliveryStream) MarshalJSON() ([]byte, error) { + type Properties AWSKinesisFirehoseDeliveryStream + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSKinesisFirehoseDeliveryStream) UnmarshalJSON(b []byte) error { + type Properties AWSKinesisFirehoseDeliveryStream + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSKinesisFirehoseDeliveryStream(*res.Properties) + } + + return nil +} + +// GetAllAWSKinesisFirehoseDeliveryStreamResources retrieves all AWSKinesisFirehoseDeliveryStream items from an AWS CloudFormation template +func (t *Template) GetAllAWSKinesisFirehoseDeliveryStreamResources() map[string]AWSKinesisFirehoseDeliveryStream { + results := map[string]AWSKinesisFirehoseDeliveryStream{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSKinesisFirehoseDeliveryStream: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KinesisFirehose::DeliveryStream" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisFirehoseDeliveryStream + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSKinesisFirehoseDeliveryStreamWithName retrieves all AWSKinesisFirehoseDeliveryStream items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSKinesisFirehoseDeliveryStreamWithName(name string) (AWSKinesisFirehoseDeliveryStream, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSKinesisFirehoseDeliveryStream: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KinesisFirehose::DeliveryStream" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKinesisFirehoseDeliveryStream + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSKinesisFirehoseDeliveryStream{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_bufferinghints.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_bufferinghints.go new file mode 100644 index 0000000000..dbfb7b9924 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_bufferinghints.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_BufferingHints AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.BufferingHints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-bufferinghints.html +type AWSKinesisFirehoseDeliveryStream_BufferingHints struct { + + // IntervalInSeconds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-bufferinghints.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-bufferinghints-intervalinseconds + IntervalInSeconds int `json:"IntervalInSeconds,omitempty"` + + // SizeInMBs AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-bufferinghints.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-bufferinghints-sizeinmbs + SizeInMBs int `json:"SizeInMBs,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_BufferingHints) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.BufferingHints" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_BufferingHints) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_cloudwatchloggingoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_cloudwatchloggingoptions.go new file mode 100644 index 0000000000..85d205a613 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_cloudwatchloggingoptions.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.CloudWatchLoggingOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-destination-cloudwatchloggingoptions.html +type AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-destination-cloudwatchloggingoptions.html#cfn-kinesisfirehose-kinesisdeliverystream-destination-cloudwatchloggingoptions-enabled + Enabled bool `json:"Enabled,omitempty"` + + // LogGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-destination-cloudwatchloggingoptions.html#cfn-kinesisfirehose-kinesisdeliverystream-destination-cloudwatchloggingoptions-loggroupname + LogGroupName string `json:"LogGroupName,omitempty"` + + // LogStreamName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-destination-cloudwatchloggingoptions.html#cfn-kinesisfirehose-kinesisdeliverystream-destination-cloudwatchloggingoptions-logstreamname + LogStreamName string `json:"LogStreamName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.CloudWatchLoggingOptions" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_copycommand.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_copycommand.go new file mode 100644 index 0000000000..6b023b7dfe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_copycommand.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_CopyCommand AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.CopyCommand) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-copycommand.html +type AWSKinesisFirehoseDeliveryStream_CopyCommand struct { + + // CopyOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-copycommand.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-copycommand-copyoptions + CopyOptions string `json:"CopyOptions,omitempty"` + + // DataTableColumns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-copycommand.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-copycommand-datatablecolumns + DataTableColumns string `json:"DataTableColumns,omitempty"` + + // DataTableName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-copycommand.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-copycommand-datatablename + DataTableName string `json:"DataTableName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_CopyCommand) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.CopyCommand" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_CopyCommand) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchbufferinghints.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchbufferinghints.go new file mode 100644 index 0000000000..37c092402b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchbufferinghints.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ElasticsearchBufferingHints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints struct { + + // IntervalInSeconds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-bufferinghints-intervalinseconds + IntervalInSeconds int `json:"IntervalInSeconds,omitempty"` + + // SizeInMBs AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-bufferinghints-sizeinmbs + SizeInMBs int `json:"SizeInMBs,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ElasticsearchBufferingHints" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchdestinationconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchdestinationconfiguration.go new file mode 100644 index 0000000000..73abede8f4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchdestinationconfiguration.go @@ -0,0 +1,66 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ElasticsearchDestinationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration struct { + + // BufferingHints AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-bufferinghints + BufferingHints *AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints `json:"BufferingHints,omitempty"` + + // CloudWatchLoggingOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-cloudwatchloggingoptions + CloudWatchLoggingOptions *AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions `json:"CloudWatchLoggingOptions,omitempty"` + + // DomainARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-domainarn + DomainARN string `json:"DomainARN,omitempty"` + + // IndexName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-indexname + IndexName string `json:"IndexName,omitempty"` + + // IndexRotationPeriod AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-indexrotationperiod + IndexRotationPeriod string `json:"IndexRotationPeriod,omitempty"` + + // RetryOptions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-retryoptions + RetryOptions *AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions `json:"RetryOptions,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // S3BackupMode AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-s3backupmode + S3BackupMode string `json:"S3BackupMode,omitempty"` + + // S3Configuration AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-s3configuration + S3Configuration *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration `json:"S3Configuration,omitempty"` + + // TypeName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-typename + TypeName string `json:"TypeName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ElasticsearchDestinationConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchretryoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchretryoptions.go new file mode 100644 index 0000000000..335ce7af7e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchretryoptions.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ElasticsearchRetryOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-retryoptions.html +type AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions struct { + + // DurationInSeconds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-retryoptions.html#cfn-kinesisfirehose-kinesisdeliverystream-elasticsearchdestinationconfiguration-retryoptions-durationinseconds + DurationInSeconds int `json:"DurationInSeconds,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ElasticsearchRetryOptions" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_encryptionconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_encryptionconfiguration.go new file mode 100644 index 0000000000..56001a3d35 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_encryptionconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.EncryptionConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration.html +type AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration struct { + + // KMSEncryptionConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration-kmsencryptionconfig + KMSEncryptionConfig *AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig `json:"KMSEncryptionConfig,omitempty"` + + // NoEncryptionConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration-noencryptionconfig + NoEncryptionConfig string `json:"NoEncryptionConfig,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.EncryptionConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_kmsencryptionconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_kmsencryptionconfig.go new file mode 100644 index 0000000000..4bc1b0f4d2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_kmsencryptionconfig.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.KMSEncryptionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration-kmsencryptionconfig.html +type AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig struct { + + // AWSKMSKeyARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration-kmsencryptionconfig.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration-kmsencryptionconfig-awskmskeyarn + AWSKMSKeyARN string `json:"AWSKMSKeyARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.KMSEncryptionConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_redshiftdestinationconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_redshiftdestinationconfiguration.go new file mode 100644 index 0000000000..35e78e7bdb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_redshiftdestinationconfiguration.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.RedshiftDestinationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration struct { + + // CloudWatchLoggingOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-cloudwatchloggingoptions + CloudWatchLoggingOptions *AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions `json:"CloudWatchLoggingOptions,omitempty"` + + // ClusterJDBCURL AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-clusterjdbcurl + ClusterJDBCURL string `json:"ClusterJDBCURL,omitempty"` + + // CopyCommand AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-copycommand + CopyCommand *AWSKinesisFirehoseDeliveryStream_CopyCommand `json:"CopyCommand,omitempty"` + + // Password AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-password + Password string `json:"Password,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // S3Configuration AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-s3configuration + S3Configuration *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration `json:"S3Configuration,omitempty"` + + // Username AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-redshiftdestinationconfiguration-usename + Username string `json:"Username,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.RedshiftDestinationConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_s3destinationconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_s3destinationconfiguration.go new file mode 100644 index 0000000000..2451704190 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_s3destinationconfiguration.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.S3DestinationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration struct { + + // BucketARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-bucketarn + BucketARN string `json:"BucketARN,omitempty"` + + // BufferingHints AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-bufferinghints + BufferingHints *AWSKinesisFirehoseDeliveryStream_BufferingHints `json:"BufferingHints,omitempty"` + + // CloudWatchLoggingOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-cloudwatchloggingoptions + CloudWatchLoggingOptions *AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions `json:"CloudWatchLoggingOptions,omitempty"` + + // CompressionFormat AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-compressionformat + CompressionFormat string `json:"CompressionFormat,omitempty"` + + // EncryptionConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-encryptionconfiguration + EncryptionConfiguration *AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration `json:"EncryptionConfiguration,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-prefix + Prefix string `json:"Prefix,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-kinesisdeliverystream-s3destinationconfiguration-rolearn + RoleARN string `json:"RoleARN,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.S3DestinationConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kms-alias.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kms-alias.go new file mode 100644 index 0000000000..5a74804f36 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kms-alias.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSKMSAlias AWS CloudFormation Resource (AWS::KMS::Alias) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html +type AWSKMSAlias struct { + + // AliasName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html#cfn-kms-alias-aliasname + AliasName string `json:"AliasName,omitempty"` + + // TargetKeyId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html#cfn-kms-alias-targetkeyid + TargetKeyId string `json:"TargetKeyId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKMSAlias) AWSCloudFormationType() string { + return "AWS::KMS::Alias" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKMSAlias) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSKMSAlias) MarshalJSON() ([]byte, error) { + type Properties AWSKMSAlias + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSKMSAlias) UnmarshalJSON(b []byte) error { + type Properties AWSKMSAlias + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSKMSAlias(*res.Properties) + } + + return nil +} + +// GetAllAWSKMSAliasResources retrieves all AWSKMSAlias items from an AWS CloudFormation template +func (t *Template) GetAllAWSKMSAliasResources() map[string]AWSKMSAlias { + results := map[string]AWSKMSAlias{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSKMSAlias: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KMS::Alias" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKMSAlias + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSKMSAliasWithName retrieves all AWSKMSAlias items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSKMSAliasWithName(name string) (AWSKMSAlias, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSKMSAlias: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KMS::Alias" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKMSAlias + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSKMSAlias{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kms-key.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kms-key.go new file mode 100644 index 0000000000..c6e23f1111 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kms-key.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSKMSKey AWS CloudFormation Resource (AWS::KMS::Key) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html +type AWSKMSKey struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-description + Description string `json:"Description,omitempty"` + + // EnableKeyRotation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-enablekeyrotation + EnableKeyRotation bool `json:"EnableKeyRotation,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-enabled + Enabled bool `json:"Enabled,omitempty"` + + // KeyPolicy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-keypolicy + KeyPolicy interface{} `json:"KeyPolicy,omitempty"` + + // KeyUsage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-keyusage + KeyUsage string `json:"KeyUsage,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKMSKey) AWSCloudFormationType() string { + return "AWS::KMS::Key" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSKMSKey) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSKMSKey) MarshalJSON() ([]byte, error) { + type Properties AWSKMSKey + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSKMSKey) UnmarshalJSON(b []byte) error { + type Properties AWSKMSKey + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSKMSKey(*res.Properties) + } + + return nil +} + +// GetAllAWSKMSKeyResources retrieves all AWSKMSKey items from an AWS CloudFormation template +func (t *Template) GetAllAWSKMSKeyResources() map[string]AWSKMSKey { + results := map[string]AWSKMSKey{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSKMSKey: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KMS::Key" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKMSKey + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSKMSKeyWithName retrieves all AWSKMSKey items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSKMSKeyWithName(name string) (AWSKMSKey, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSKMSKey: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::KMS::Key" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSKMSKey + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSKMSKey{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias.go new file mode 100644 index 0000000000..46f84ba116 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLambdaAlias AWS CloudFormation Resource (AWS::Lambda::Alias) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html +type AWSLambdaAlias struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html#cfn-lambda-alias-description + Description string `json:"Description,omitempty"` + + // FunctionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html#cfn-lambda-alias-functionname + FunctionName string `json:"FunctionName,omitempty"` + + // FunctionVersion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html#cfn-lambda-alias-functionversion + FunctionVersion string `json:"FunctionVersion,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html#cfn-lambda-alias-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaAlias) AWSCloudFormationType() string { + return "AWS::Lambda::Alias" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaAlias) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLambdaAlias) MarshalJSON() ([]byte, error) { + type Properties AWSLambdaAlias + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLambdaAlias) UnmarshalJSON(b []byte) error { + type Properties AWSLambdaAlias + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLambdaAlias(*res.Properties) + } + + return nil +} + +// GetAllAWSLambdaAliasResources retrieves all AWSLambdaAlias items from an AWS CloudFormation template +func (t *Template) GetAllAWSLambdaAliasResources() map[string]AWSLambdaAlias { + results := map[string]AWSLambdaAlias{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLambdaAlias: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::Alias" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaAlias + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLambdaAliasWithName retrieves all AWSLambdaAlias items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLambdaAliasWithName(name string) (AWSLambdaAlias, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLambdaAlias: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::Alias" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaAlias + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLambdaAlias{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-eventsourcemapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-eventsourcemapping.go new file mode 100644 index 0000000000..22ea4a90bc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-eventsourcemapping.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLambdaEventSourceMapping AWS CloudFormation Resource (AWS::Lambda::EventSourceMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html +type AWSLambdaEventSourceMapping struct { + + // BatchSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-batchsize + BatchSize int `json:"BatchSize,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-enabled + Enabled bool `json:"Enabled,omitempty"` + + // EventSourceArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-eventsourcearn + EventSourceArn string `json:"EventSourceArn,omitempty"` + + // FunctionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-functionname + FunctionName string `json:"FunctionName,omitempty"` + + // StartingPosition AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingposition + StartingPosition string `json:"StartingPosition,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaEventSourceMapping) AWSCloudFormationType() string { + return "AWS::Lambda::EventSourceMapping" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaEventSourceMapping) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLambdaEventSourceMapping) MarshalJSON() ([]byte, error) { + type Properties AWSLambdaEventSourceMapping + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLambdaEventSourceMapping) UnmarshalJSON(b []byte) error { + type Properties AWSLambdaEventSourceMapping + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLambdaEventSourceMapping(*res.Properties) + } + + return nil +} + +// GetAllAWSLambdaEventSourceMappingResources retrieves all AWSLambdaEventSourceMapping items from an AWS CloudFormation template +func (t *Template) GetAllAWSLambdaEventSourceMappingResources() map[string]AWSLambdaEventSourceMapping { + results := map[string]AWSLambdaEventSourceMapping{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLambdaEventSourceMapping: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::EventSourceMapping" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaEventSourceMapping + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLambdaEventSourceMappingWithName retrieves all AWSLambdaEventSourceMapping items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLambdaEventSourceMappingWithName(name string) (AWSLambdaEventSourceMapping, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLambdaEventSourceMapping: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::EventSourceMapping" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaEventSourceMapping + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLambdaEventSourceMapping{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function.go new file mode 100644 index 0000000000..508ffb224b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function.go @@ -0,0 +1,180 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLambdaFunction AWS CloudFormation Resource (AWS::Lambda::Function) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html +type AWSLambdaFunction struct { + + // Code AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-code + Code *AWSLambdaFunction_Code `json:"Code,omitempty"` + + // DeadLetterConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-deadletterconfig + DeadLetterConfig *AWSLambdaFunction_DeadLetterConfig `json:"DeadLetterConfig,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-description + Description string `json:"Description,omitempty"` + + // Environment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-environment + Environment *AWSLambdaFunction_Environment `json:"Environment,omitempty"` + + // FunctionName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-functionname + FunctionName string `json:"FunctionName,omitempty"` + + // Handler AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-handler + Handler string `json:"Handler,omitempty"` + + // KmsKeyArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-kmskeyarn + KmsKeyArn string `json:"KmsKeyArn,omitempty"` + + // MemorySize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-memorysize + MemorySize int `json:"MemorySize,omitempty"` + + // Role AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-role + Role string `json:"Role,omitempty"` + + // Runtime AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime + Runtime string `json:"Runtime,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-tags + Tags []Tag `json:"Tags,omitempty"` + + // Timeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-timeout + Timeout int `json:"Timeout,omitempty"` + + // TracingConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-tracingconfig + TracingConfig *AWSLambdaFunction_TracingConfig `json:"TracingConfig,omitempty"` + + // VpcConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-vpcconfig + VpcConfig *AWSLambdaFunction_VpcConfig `json:"VpcConfig,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction) AWSCloudFormationType() string { + return "AWS::Lambda::Function" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaFunction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLambdaFunction) MarshalJSON() ([]byte, error) { + type Properties AWSLambdaFunction + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLambdaFunction) UnmarshalJSON(b []byte) error { + type Properties AWSLambdaFunction + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLambdaFunction(*res.Properties) + } + + return nil +} + +// GetAllAWSLambdaFunctionResources retrieves all AWSLambdaFunction items from an AWS CloudFormation template +func (t *Template) GetAllAWSLambdaFunctionResources() map[string]AWSLambdaFunction { + results := map[string]AWSLambdaFunction{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLambdaFunction: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::Function" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaFunction + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLambdaFunctionWithName retrieves all AWSLambdaFunction items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLambdaFunctionWithName(name string) (AWSLambdaFunction, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLambdaFunction: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::Function" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaFunction + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLambdaFunction{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_code.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_code.go new file mode 100644 index 0000000000..588dfd3548 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_code.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSLambdaFunction_Code AWS CloudFormation Resource (AWS::Lambda::Function.Code) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html +type AWSLambdaFunction_Code struct { + + // S3Bucket AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3bucket + S3Bucket string `json:"S3Bucket,omitempty"` + + // S3Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3key + S3Key string `json:"S3Key,omitempty"` + + // S3ObjectVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-s3objectversion + S3ObjectVersion string `json:"S3ObjectVersion,omitempty"` + + // ZipFile AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-zipfile + ZipFile string `json:"ZipFile,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_Code) AWSCloudFormationType() string { + return "AWS::Lambda::Function.Code" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaFunction_Code) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_deadletterconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_deadletterconfig.go new file mode 100644 index 0000000000..c1e7973c85 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_deadletterconfig.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSLambdaFunction_DeadLetterConfig AWS CloudFormation Resource (AWS::Lambda::Function.DeadLetterConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-deadletterconfig.html +type AWSLambdaFunction_DeadLetterConfig struct { + + // TargetArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-deadletterconfig.html#cfn-lambda-function-deadletterconfig-targetarn + TargetArn string `json:"TargetArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_DeadLetterConfig) AWSCloudFormationType() string { + return "AWS::Lambda::Function.DeadLetterConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaFunction_DeadLetterConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_environment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_environment.go new file mode 100644 index 0000000000..a0466806db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_environment.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSLambdaFunction_Environment AWS CloudFormation Resource (AWS::Lambda::Function.Environment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-environment.html +type AWSLambdaFunction_Environment struct { + + // Variables AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-environment.html#cfn-lambda-function-environment-variables + Variables map[string]string `json:"Variables,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_Environment) AWSCloudFormationType() string { + return "AWS::Lambda::Function.Environment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaFunction_Environment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_tracingconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_tracingconfig.go new file mode 100644 index 0000000000..bd78a222f6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_tracingconfig.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSLambdaFunction_TracingConfig AWS CloudFormation Resource (AWS::Lambda::Function.TracingConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-tracingconfig.html +type AWSLambdaFunction_TracingConfig struct { + + // Mode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-tracingconfig.html#cfn-lambda-function-tracingconfig-mode + Mode string `json:"Mode,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_TracingConfig) AWSCloudFormationType() string { + return "AWS::Lambda::Function.TracingConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaFunction_TracingConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_vpcconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_vpcconfig.go new file mode 100644 index 0000000000..939a3f3dd8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_vpcconfig.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSLambdaFunction_VpcConfig AWS CloudFormation Resource (AWS::Lambda::Function.VpcConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html +type AWSLambdaFunction_VpcConfig struct { + + // SecurityGroupIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html#cfn-lambda-function-vpcconfig-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html#cfn-lambda-function-vpcconfig-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_VpcConfig) AWSCloudFormationType() string { + return "AWS::Lambda::Function.VpcConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaFunction_VpcConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-permission.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-permission.go new file mode 100644 index 0000000000..97810349d7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-permission.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLambdaPermission AWS CloudFormation Resource (AWS::Lambda::Permission) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html +type AWSLambdaPermission struct { + + // Action AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html#cfn-lambda-permission-action + Action string `json:"Action,omitempty"` + + // FunctionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html#cfn-lambda-permission-functionname + FunctionName string `json:"FunctionName,omitempty"` + + // Principal AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html#cfn-lambda-permission-principal + Principal string `json:"Principal,omitempty"` + + // SourceAccount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html#cfn-lambda-permission-sourceaccount + SourceAccount string `json:"SourceAccount,omitempty"` + + // SourceArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html#cfn-lambda-permission-sourcearn + SourceArn string `json:"SourceArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaPermission) AWSCloudFormationType() string { + return "AWS::Lambda::Permission" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaPermission) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLambdaPermission) MarshalJSON() ([]byte, error) { + type Properties AWSLambdaPermission + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLambdaPermission) UnmarshalJSON(b []byte) error { + type Properties AWSLambdaPermission + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLambdaPermission(*res.Properties) + } + + return nil +} + +// GetAllAWSLambdaPermissionResources retrieves all AWSLambdaPermission items from an AWS CloudFormation template +func (t *Template) GetAllAWSLambdaPermissionResources() map[string]AWSLambdaPermission { + results := map[string]AWSLambdaPermission{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLambdaPermission: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::Permission" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaPermission + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLambdaPermissionWithName retrieves all AWSLambdaPermission items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLambdaPermissionWithName(name string) (AWSLambdaPermission, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLambdaPermission: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::Permission" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaPermission + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLambdaPermission{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-version.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-version.go new file mode 100644 index 0000000000..0d1dcb1404 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-version.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLambdaVersion AWS CloudFormation Resource (AWS::Lambda::Version) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html +type AWSLambdaVersion struct { + + // CodeSha256 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html#cfn-lambda-version-codesha256 + CodeSha256 string `json:"CodeSha256,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html#cfn-lambda-version-description + Description string `json:"Description,omitempty"` + + // FunctionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html#cfn-lambda-version-functionname + FunctionName string `json:"FunctionName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaVersion) AWSCloudFormationType() string { + return "AWS::Lambda::Version" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLambdaVersion) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLambdaVersion) MarshalJSON() ([]byte, error) { + type Properties AWSLambdaVersion + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLambdaVersion) UnmarshalJSON(b []byte) error { + type Properties AWSLambdaVersion + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLambdaVersion(*res.Properties) + } + + return nil +} + +// GetAllAWSLambdaVersionResources retrieves all AWSLambdaVersion items from an AWS CloudFormation template +func (t *Template) GetAllAWSLambdaVersionResources() map[string]AWSLambdaVersion { + results := map[string]AWSLambdaVersion{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLambdaVersion: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::Version" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaVersion + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLambdaVersionWithName retrieves all AWSLambdaVersion items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLambdaVersionWithName(name string) (AWSLambdaVersion, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLambdaVersion: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Lambda::Version" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLambdaVersion + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLambdaVersion{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-destination.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-destination.go new file mode 100644 index 0000000000..a89ba8614f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-destination.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLogsDestination AWS CloudFormation Resource (AWS::Logs::Destination) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html +type AWSLogsDestination struct { + + // DestinationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html#cfn-logs-destination-destinationname + DestinationName string `json:"DestinationName,omitempty"` + + // DestinationPolicy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html#cfn-logs-destination-destinationpolicy + DestinationPolicy string `json:"DestinationPolicy,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html#cfn-logs-destination-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // TargetArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html#cfn-logs-destination-targetarn + TargetArn string `json:"TargetArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsDestination) AWSCloudFormationType() string { + return "AWS::Logs::Destination" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLogsDestination) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLogsDestination) MarshalJSON() ([]byte, error) { + type Properties AWSLogsDestination + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLogsDestination) UnmarshalJSON(b []byte) error { + type Properties AWSLogsDestination + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLogsDestination(*res.Properties) + } + + return nil +} + +// GetAllAWSLogsDestinationResources retrieves all AWSLogsDestination items from an AWS CloudFormation template +func (t *Template) GetAllAWSLogsDestinationResources() map[string]AWSLogsDestination { + results := map[string]AWSLogsDestination{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLogsDestination: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::Destination" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsDestination + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLogsDestinationWithName retrieves all AWSLogsDestination items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLogsDestinationWithName(name string) (AWSLogsDestination, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLogsDestination: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::Destination" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsDestination + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLogsDestination{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-loggroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-loggroup.go new file mode 100644 index 0000000000..4a2b82b483 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-loggroup.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLogsLogGroup AWS CloudFormation Resource (AWS::Logs::LogGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html +type AWSLogsLogGroup struct { + + // LogGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-cwl-loggroup-loggroupname + LogGroupName string `json:"LogGroupName,omitempty"` + + // RetentionInDays AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-cwl-loggroup-retentionindays + RetentionInDays int `json:"RetentionInDays,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsLogGroup) AWSCloudFormationType() string { + return "AWS::Logs::LogGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLogsLogGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLogsLogGroup) MarshalJSON() ([]byte, error) { + type Properties AWSLogsLogGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLogsLogGroup) UnmarshalJSON(b []byte) error { + type Properties AWSLogsLogGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLogsLogGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSLogsLogGroupResources retrieves all AWSLogsLogGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSLogsLogGroupResources() map[string]AWSLogsLogGroup { + results := map[string]AWSLogsLogGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLogsLogGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::LogGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsLogGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLogsLogGroupWithName retrieves all AWSLogsLogGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLogsLogGroupWithName(name string) (AWSLogsLogGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLogsLogGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::LogGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsLogGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLogsLogGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-logstream.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-logstream.go new file mode 100644 index 0000000000..4dc626e54f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-logstream.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLogsLogStream AWS CloudFormation Resource (AWS::Logs::LogStream) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-logstream.html +type AWSLogsLogStream struct { + + // LogGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-logstream.html#cfn-logs-logstream-loggroupname + LogGroupName string `json:"LogGroupName,omitempty"` + + // LogStreamName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-logstream.html#cfn-logs-logstream-logstreamname + LogStreamName string `json:"LogStreamName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsLogStream) AWSCloudFormationType() string { + return "AWS::Logs::LogStream" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLogsLogStream) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLogsLogStream) MarshalJSON() ([]byte, error) { + type Properties AWSLogsLogStream + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLogsLogStream) UnmarshalJSON(b []byte) error { + type Properties AWSLogsLogStream + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLogsLogStream(*res.Properties) + } + + return nil +} + +// GetAllAWSLogsLogStreamResources retrieves all AWSLogsLogStream items from an AWS CloudFormation template +func (t *Template) GetAllAWSLogsLogStreamResources() map[string]AWSLogsLogStream { + results := map[string]AWSLogsLogStream{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLogsLogStream: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::LogStream" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsLogStream + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLogsLogStreamWithName retrieves all AWSLogsLogStream items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLogsLogStreamWithName(name string) (AWSLogsLogStream, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLogsLogStream: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::LogStream" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsLogStream + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLogsLogStream{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-metricfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-metricfilter.go new file mode 100644 index 0000000000..885d82403d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-metricfilter.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLogsMetricFilter AWS CloudFormation Resource (AWS::Logs::MetricFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html +type AWSLogsMetricFilter struct { + + // FilterPattern AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html#cfn-cwl-metricfilter-filterpattern + FilterPattern string `json:"FilterPattern,omitempty"` + + // LogGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html#cfn-cwl-metricfilter-loggroupname + LogGroupName string `json:"LogGroupName,omitempty"` + + // MetricTransformations AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html#cfn-cwl-metricfilter-metrictransformations + MetricTransformations []AWSLogsMetricFilter_MetricTransformation `json:"MetricTransformations,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsMetricFilter) AWSCloudFormationType() string { + return "AWS::Logs::MetricFilter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLogsMetricFilter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLogsMetricFilter) MarshalJSON() ([]byte, error) { + type Properties AWSLogsMetricFilter + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLogsMetricFilter) UnmarshalJSON(b []byte) error { + type Properties AWSLogsMetricFilter + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLogsMetricFilter(*res.Properties) + } + + return nil +} + +// GetAllAWSLogsMetricFilterResources retrieves all AWSLogsMetricFilter items from an AWS CloudFormation template +func (t *Template) GetAllAWSLogsMetricFilterResources() map[string]AWSLogsMetricFilter { + results := map[string]AWSLogsMetricFilter{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLogsMetricFilter: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::MetricFilter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsMetricFilter + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLogsMetricFilterWithName retrieves all AWSLogsMetricFilter items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLogsMetricFilterWithName(name string) (AWSLogsMetricFilter, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLogsMetricFilter: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::MetricFilter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsMetricFilter + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLogsMetricFilter{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-metricfilter_metrictransformation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-metricfilter_metrictransformation.go new file mode 100644 index 0000000000..720a30a3d5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-metricfilter_metrictransformation.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSLogsMetricFilter_MetricTransformation AWS CloudFormation Resource (AWS::Logs::MetricFilter.MetricTransformation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html +type AWSLogsMetricFilter_MetricTransformation struct { + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-cwl-metricfilter-metrictransformation-metricname + MetricName string `json:"MetricName,omitempty"` + + // MetricNamespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-cwl-metricfilter-metrictransformation-metricnamespace + MetricNamespace string `json:"MetricNamespace,omitempty"` + + // MetricValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-cwl-metricfilter-metrictransformation-metricvalue + MetricValue string `json:"MetricValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsMetricFilter_MetricTransformation) AWSCloudFormationType() string { + return "AWS::Logs::MetricFilter.MetricTransformation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLogsMetricFilter_MetricTransformation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-subscriptionfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-subscriptionfilter.go new file mode 100644 index 0000000000..b857baa987 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-subscriptionfilter.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSLogsSubscriptionFilter AWS CloudFormation Resource (AWS::Logs::SubscriptionFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html +type AWSLogsSubscriptionFilter struct { + + // DestinationArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html#cfn-cwl-subscriptionfilter-destinationarn + DestinationArn string `json:"DestinationArn,omitempty"` + + // FilterPattern AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html#cfn-cwl-subscriptionfilter-filterpattern + FilterPattern string `json:"FilterPattern,omitempty"` + + // LogGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html#cfn-cwl-subscriptionfilter-loggroupname + LogGroupName string `json:"LogGroupName,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html#cfn-cwl-subscriptionfilter-rolearn + RoleArn string `json:"RoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsSubscriptionFilter) AWSCloudFormationType() string { + return "AWS::Logs::SubscriptionFilter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSLogsSubscriptionFilter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSLogsSubscriptionFilter) MarshalJSON() ([]byte, error) { + type Properties AWSLogsSubscriptionFilter + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSLogsSubscriptionFilter) UnmarshalJSON(b []byte) error { + type Properties AWSLogsSubscriptionFilter + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSLogsSubscriptionFilter(*res.Properties) + } + + return nil +} + +// GetAllAWSLogsSubscriptionFilterResources retrieves all AWSLogsSubscriptionFilter items from an AWS CloudFormation template +func (t *Template) GetAllAWSLogsSubscriptionFilterResources() map[string]AWSLogsSubscriptionFilter { + results := map[string]AWSLogsSubscriptionFilter{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSLogsSubscriptionFilter: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::SubscriptionFilter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsSubscriptionFilter + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSLogsSubscriptionFilterWithName retrieves all AWSLogsSubscriptionFilter items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSLogsSubscriptionFilterWithName(name string) (AWSLogsSubscriptionFilter, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSLogsSubscriptionFilter: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Logs::SubscriptionFilter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSLogsSubscriptionFilter + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSLogsSubscriptionFilter{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app.go new file mode 100644 index 0000000000..2cdac5218a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app.go @@ -0,0 +1,170 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSOpsWorksApp AWS CloudFormation Resource (AWS::OpsWorks::App) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html +type AWSOpsWorksApp struct { + + // AppSource AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-appsource + AppSource *AWSOpsWorksApp_Source `json:"AppSource,omitempty"` + + // Attributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-attributes + Attributes map[string]string `json:"Attributes,omitempty"` + + // DataSources AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-datasources + DataSources []AWSOpsWorksApp_DataSource `json:"DataSources,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-description + Description string `json:"Description,omitempty"` + + // Domains AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-domains + Domains []string `json:"Domains,omitempty"` + + // EnableSsl AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-enablessl + EnableSsl bool `json:"EnableSsl,omitempty"` + + // Environment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-environment + Environment []AWSOpsWorksApp_EnvironmentVariable `json:"Environment,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-name + Name string `json:"Name,omitempty"` + + // Shortname AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-shortname + Shortname string `json:"Shortname,omitempty"` + + // SslConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-sslconfiguration + SslConfiguration *AWSOpsWorksApp_SslConfiguration `json:"SslConfiguration,omitempty"` + + // StackId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-stackid + StackId string `json:"StackId,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-app.html#cfn-opsworks-app-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp) AWSCloudFormationType() string { + return "AWS::OpsWorks::App" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksApp) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSOpsWorksApp) MarshalJSON() ([]byte, error) { + type Properties AWSOpsWorksApp + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSOpsWorksApp) UnmarshalJSON(b []byte) error { + type Properties AWSOpsWorksApp + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSOpsWorksApp(*res.Properties) + } + + return nil +} + +// GetAllAWSOpsWorksAppResources retrieves all AWSOpsWorksApp items from an AWS CloudFormation template +func (t *Template) GetAllAWSOpsWorksAppResources() map[string]AWSOpsWorksApp { + results := map[string]AWSOpsWorksApp{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSOpsWorksApp: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::App" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksApp + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSOpsWorksAppWithName retrieves all AWSOpsWorksApp items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSOpsWorksAppWithName(name string) (AWSOpsWorksApp, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSOpsWorksApp: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::App" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksApp + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSOpsWorksApp{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_datasource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_datasource.go new file mode 100644 index 0000000000..728df908cd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_datasource.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSOpsWorksApp_DataSource AWS CloudFormation Resource (AWS::OpsWorks::App.DataSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-datasource.html +type AWSOpsWorksApp_DataSource struct { + + // Arn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-datasource.html#cfn-opsworks-app-datasource-arn + Arn string `json:"Arn,omitempty"` + + // DatabaseName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-datasource.html#cfn-opsworks-app-datasource-databasename + DatabaseName string `json:"DatabaseName,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-datasource.html#cfn-opsworks-app-datasource-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp_DataSource) AWSCloudFormationType() string { + return "AWS::OpsWorks::App.DataSource" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksApp_DataSource) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_environmentvariable.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_environmentvariable.go new file mode 100644 index 0000000000..03320d4b86 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_environmentvariable.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSOpsWorksApp_EnvironmentVariable AWS CloudFormation Resource (AWS::OpsWorks::App.EnvironmentVariable) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-environment.html +type AWSOpsWorksApp_EnvironmentVariable struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-environment.html#cfn-opsworks-app-environment-key + Key string `json:"Key,omitempty"` + + // Secure AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-environment.html#cfn-opsworks-app-environment-secure + Secure bool `json:"Secure,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-environment.html#value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp_EnvironmentVariable) AWSCloudFormationType() string { + return "AWS::OpsWorks::App.EnvironmentVariable" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksApp_EnvironmentVariable) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_source.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_source.go new file mode 100644 index 0000000000..b2db3e8eb0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_source.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSOpsWorksApp_Source AWS CloudFormation Resource (AWS::OpsWorks::App.Source) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html +type AWSOpsWorksApp_Source struct { + + // Password AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-pw + Password string `json:"Password,omitempty"` + + // Revision AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-revision + Revision string `json:"Revision,omitempty"` + + // SshKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-sshkey + SshKey string `json:"SshKey,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-type + Type string `json:"Type,omitempty"` + + // Url AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-url + Url string `json:"Url,omitempty"` + + // Username AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-username + Username string `json:"Username,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp_Source) AWSCloudFormationType() string { + return "AWS::OpsWorks::App.Source" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksApp_Source) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_sslconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_sslconfiguration.go new file mode 100644 index 0000000000..3cc093ee67 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_sslconfiguration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSOpsWorksApp_SslConfiguration AWS CloudFormation Resource (AWS::OpsWorks::App.SslConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-sslconfiguration.html +type AWSOpsWorksApp_SslConfiguration struct { + + // Certificate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-sslconfiguration.html#cfn-opsworks-app-sslconfig-certificate + Certificate string `json:"Certificate,omitempty"` + + // Chain AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-sslconfiguration.html#cfn-opsworks-app-sslconfig-chain + Chain string `json:"Chain,omitempty"` + + // PrivateKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-app-sslconfiguration.html#cfn-opsworks-app-sslconfig-privatekey + PrivateKey string `json:"PrivateKey,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp_SslConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::App.SslConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksApp_SslConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-elasticloadbalancerattachment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-elasticloadbalancerattachment.go new file mode 100644 index 0000000000..5477afa701 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-elasticloadbalancerattachment.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSOpsWorksElasticLoadBalancerAttachment AWS CloudFormation Resource (AWS::OpsWorks::ElasticLoadBalancerAttachment) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-elbattachment.html +type AWSOpsWorksElasticLoadBalancerAttachment struct { + + // ElasticLoadBalancerName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-elbattachment.html#cfn-opsworks-elbattachment-elbname + ElasticLoadBalancerName string `json:"ElasticLoadBalancerName,omitempty"` + + // LayerId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-elbattachment.html#cfn-opsworks-elbattachment-layerid + LayerId string `json:"LayerId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksElasticLoadBalancerAttachment) AWSCloudFormationType() string { + return "AWS::OpsWorks::ElasticLoadBalancerAttachment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksElasticLoadBalancerAttachment) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSOpsWorksElasticLoadBalancerAttachment) MarshalJSON() ([]byte, error) { + type Properties AWSOpsWorksElasticLoadBalancerAttachment + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSOpsWorksElasticLoadBalancerAttachment) UnmarshalJSON(b []byte) error { + type Properties AWSOpsWorksElasticLoadBalancerAttachment + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSOpsWorksElasticLoadBalancerAttachment(*res.Properties) + } + + return nil +} + +// GetAllAWSOpsWorksElasticLoadBalancerAttachmentResources retrieves all AWSOpsWorksElasticLoadBalancerAttachment items from an AWS CloudFormation template +func (t *Template) GetAllAWSOpsWorksElasticLoadBalancerAttachmentResources() map[string]AWSOpsWorksElasticLoadBalancerAttachment { + results := map[string]AWSOpsWorksElasticLoadBalancerAttachment{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSOpsWorksElasticLoadBalancerAttachment: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::ElasticLoadBalancerAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksElasticLoadBalancerAttachment + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSOpsWorksElasticLoadBalancerAttachmentWithName retrieves all AWSOpsWorksElasticLoadBalancerAttachment items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSOpsWorksElasticLoadBalancerAttachmentWithName(name string) (AWSOpsWorksElasticLoadBalancerAttachment, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSOpsWorksElasticLoadBalancerAttachment: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::ElasticLoadBalancerAttachment" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksElasticLoadBalancerAttachment + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSOpsWorksElasticLoadBalancerAttachment{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance.go new file mode 100644 index 0000000000..31b040b436 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance.go @@ -0,0 +1,215 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSOpsWorksInstance AWS CloudFormation Resource (AWS::OpsWorks::Instance) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html +type AWSOpsWorksInstance struct { + + // AgentVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-agentversion + AgentVersion string `json:"AgentVersion,omitempty"` + + // AmiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-amiid + AmiId string `json:"AmiId,omitempty"` + + // Architecture AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-architecture + Architecture string `json:"Architecture,omitempty"` + + // AutoScalingType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-autoscalingtype + AutoScalingType string `json:"AutoScalingType,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // BlockDeviceMappings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-blockdevicemappings + BlockDeviceMappings []AWSOpsWorksInstance_BlockDeviceMapping `json:"BlockDeviceMappings,omitempty"` + + // EbsOptimized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` + + // ElasticIps AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-elasticips + ElasticIps []string `json:"ElasticIps,omitempty"` + + // Hostname AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-hostname + Hostname string `json:"Hostname,omitempty"` + + // InstallUpdatesOnBoot AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-installupdatesonboot + InstallUpdatesOnBoot bool `json:"InstallUpdatesOnBoot,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // LayerIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-layerids + LayerIds []string `json:"LayerIds,omitempty"` + + // Os AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-os + Os string `json:"Os,omitempty"` + + // RootDeviceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-rootdevicetype + RootDeviceType string `json:"RootDeviceType,omitempty"` + + // SshKeyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-sshkeyname + SshKeyName string `json:"SshKeyName,omitempty"` + + // StackId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-stackid + StackId string `json:"StackId,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // Tenancy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-tenancy + Tenancy string `json:"Tenancy,omitempty"` + + // TimeBasedAutoScaling AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-timebasedautoscaling + TimeBasedAutoScaling *AWSOpsWorksInstance_TimeBasedAutoScaling `json:"TimeBasedAutoScaling,omitempty"` + + // VirtualizationType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-virtualizationtype + VirtualizationType string `json:"VirtualizationType,omitempty"` + + // Volumes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-instance.html#cfn-opsworks-instance-volumes + Volumes []string `json:"Volumes,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksInstance) AWSCloudFormationType() string { + return "AWS::OpsWorks::Instance" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksInstance) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSOpsWorksInstance) MarshalJSON() ([]byte, error) { + type Properties AWSOpsWorksInstance + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSOpsWorksInstance) UnmarshalJSON(b []byte) error { + type Properties AWSOpsWorksInstance + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSOpsWorksInstance(*res.Properties) + } + + return nil +} + +// GetAllAWSOpsWorksInstanceResources retrieves all AWSOpsWorksInstance items from an AWS CloudFormation template +func (t *Template) GetAllAWSOpsWorksInstanceResources() map[string]AWSOpsWorksInstance { + results := map[string]AWSOpsWorksInstance{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSOpsWorksInstance: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::Instance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksInstance + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSOpsWorksInstanceWithName retrieves all AWSOpsWorksInstance items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSOpsWorksInstanceWithName(name string) (AWSOpsWorksInstance, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSOpsWorksInstance: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::Instance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksInstance + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSOpsWorksInstance{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_blockdevicemapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_blockdevicemapping.go new file mode 100644 index 0000000000..5fb05dc83f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_blockdevicemapping.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSOpsWorksInstance_BlockDeviceMapping AWS CloudFormation Resource (AWS::OpsWorks::Instance.BlockDeviceMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-blockdevicemapping.html +type AWSOpsWorksInstance_BlockDeviceMapping struct { + + // DeviceName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-blockdevicemapping.html#cfn-opsworks-instance-blockdevicemapping-devicename + DeviceName string `json:"DeviceName,omitempty"` + + // Ebs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-blockdevicemapping.html#cfn-opsworks-instance-blockdevicemapping-ebs + Ebs *AWSOpsWorksInstance_EbsBlockDevice `json:"Ebs,omitempty"` + + // NoDevice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-blockdevicemapping.html#cfn-opsworks-instance-blockdevicemapping-nodevice + NoDevice string `json:"NoDevice,omitempty"` + + // VirtualName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-blockdevicemapping.html#cfn-opsworks-instance-blockdevicemapping-virtualname + VirtualName string `json:"VirtualName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksInstance_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::OpsWorks::Instance.BlockDeviceMapping" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksInstance_BlockDeviceMapping) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_ebsblockdevice.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_ebsblockdevice.go new file mode 100644 index 0000000000..14b2b0e85f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_ebsblockdevice.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSOpsWorksInstance_EbsBlockDevice AWS CloudFormation Resource (AWS::OpsWorks::Instance.EbsBlockDevice) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-ebsblockdevice.html +type AWSOpsWorksInstance_EbsBlockDevice struct { + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-ebsblockdevice.html#cfn-opsworks-instance-ebsblockdevice-deleteontermination + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-ebsblockdevice.html#cfn-opsworks-instance-ebsblockdevice-iops + Iops int `json:"Iops,omitempty"` + + // SnapshotId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-ebsblockdevice.html#cfn-opsworks-instance-ebsblockdevice-snapshotid + SnapshotId string `json:"SnapshotId,omitempty"` + + // VolumeSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-ebsblockdevice.html#cfn-opsworks-instance-ebsblockdevice-volumesize + VolumeSize int `json:"VolumeSize,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-ebsblockdevice.html#cfn-opsworks-instance-ebsblockdevice-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksInstance_EbsBlockDevice) AWSCloudFormationType() string { + return "AWS::OpsWorks::Instance.EbsBlockDevice" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksInstance_EbsBlockDevice) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_timebasedautoscaling.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_timebasedautoscaling.go new file mode 100644 index 0000000000..d766691f03 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_timebasedautoscaling.go @@ -0,0 +1,51 @@ +package cloudformation + +// AWSOpsWorksInstance_TimeBasedAutoScaling AWS CloudFormation Resource (AWS::OpsWorks::Instance.TimeBasedAutoScaling) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-timebasedautoscaling.html +type AWSOpsWorksInstance_TimeBasedAutoScaling struct { + + // Friday AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-timebasedautoscaling.html#cfn-opsworks-instance-timebasedautoscaling-friday + Friday map[string]string `json:"Friday,omitempty"` + + // Monday AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-timebasedautoscaling.html#cfn-opsworks-instance-timebasedautoscaling-monday + Monday map[string]string `json:"Monday,omitempty"` + + // Saturday AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-timebasedautoscaling.html#cfn-opsworks-instance-timebasedautoscaling-saturday + Saturday map[string]string `json:"Saturday,omitempty"` + + // Sunday AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-timebasedautoscaling.html#cfn-opsworks-instance-timebasedautoscaling-sunday + Sunday map[string]string `json:"Sunday,omitempty"` + + // Thursday AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-timebasedautoscaling.html#cfn-opsworks-instance-timebasedautoscaling-thursday + Thursday map[string]string `json:"Thursday,omitempty"` + + // Tuesday AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-timebasedautoscaling.html#cfn-opsworks-instance-timebasedautoscaling-tuesday + Tuesday map[string]string `json:"Tuesday,omitempty"` + + // Wednesday AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-instance-timebasedautoscaling.html#cfn-opsworks-instance-timebasedautoscaling-wednesday + Wednesday map[string]string `json:"Wednesday,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksInstance_TimeBasedAutoScaling) AWSCloudFormationType() string { + return "AWS::OpsWorks::Instance.TimeBasedAutoScaling" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksInstance_TimeBasedAutoScaling) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer.go new file mode 100644 index 0000000000..3a343fe794 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer.go @@ -0,0 +1,200 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSOpsWorksLayer AWS CloudFormation Resource (AWS::OpsWorks::Layer) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html +type AWSOpsWorksLayer struct { + + // Attributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-attributes + Attributes map[string]string `json:"Attributes,omitempty"` + + // AutoAssignElasticIps AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-autoassignelasticips + AutoAssignElasticIps bool `json:"AutoAssignElasticIps,omitempty"` + + // AutoAssignPublicIps AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-autoassignpublicips + AutoAssignPublicIps bool `json:"AutoAssignPublicIps,omitempty"` + + // CustomInstanceProfileArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-custominstanceprofilearn + CustomInstanceProfileArn string `json:"CustomInstanceProfileArn,omitempty"` + + // CustomJson AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-customjson + CustomJson interface{} `json:"CustomJson,omitempty"` + + // CustomRecipes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-customrecipes + CustomRecipes *AWSOpsWorksLayer_Recipes `json:"CustomRecipes,omitempty"` + + // CustomSecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-customsecuritygroupids + CustomSecurityGroupIds []string `json:"CustomSecurityGroupIds,omitempty"` + + // EnableAutoHealing AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-enableautohealing + EnableAutoHealing bool `json:"EnableAutoHealing,omitempty"` + + // InstallUpdatesOnBoot AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-installupdatesonboot + InstallUpdatesOnBoot bool `json:"InstallUpdatesOnBoot,omitempty"` + + // LifecycleEventConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-lifecycleeventconfiguration + LifecycleEventConfiguration *AWSOpsWorksLayer_LifecycleEventConfiguration `json:"LifecycleEventConfiguration,omitempty"` + + // LoadBasedAutoScaling AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-loadbasedautoscaling + LoadBasedAutoScaling *AWSOpsWorksLayer_LoadBasedAutoScaling `json:"LoadBasedAutoScaling,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-name + Name string `json:"Name,omitempty"` + + // Packages AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-packages + Packages []string `json:"Packages,omitempty"` + + // Shortname AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-shortname + Shortname string `json:"Shortname,omitempty"` + + // StackId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-stackid + StackId string `json:"StackId,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-type + Type string `json:"Type,omitempty"` + + // UseEbsOptimizedInstances AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-useebsoptimizedinstances + UseEbsOptimizedInstances bool `json:"UseEbsOptimizedInstances,omitempty"` + + // VolumeConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-volumeconfigurations + VolumeConfigurations []AWSOpsWorksLayer_VolumeConfiguration `json:"VolumeConfigurations,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksLayer) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSOpsWorksLayer) MarshalJSON() ([]byte, error) { + type Properties AWSOpsWorksLayer + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSOpsWorksLayer) UnmarshalJSON(b []byte) error { + type Properties AWSOpsWorksLayer + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSOpsWorksLayer(*res.Properties) + } + + return nil +} + +// GetAllAWSOpsWorksLayerResources retrieves all AWSOpsWorksLayer items from an AWS CloudFormation template +func (t *Template) GetAllAWSOpsWorksLayerResources() map[string]AWSOpsWorksLayer { + results := map[string]AWSOpsWorksLayer{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSOpsWorksLayer: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::Layer" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksLayer + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSOpsWorksLayerWithName retrieves all AWSOpsWorksLayer items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSOpsWorksLayerWithName(name string) (AWSOpsWorksLayer, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSOpsWorksLayer: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::Layer" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksLayer + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSOpsWorksLayer{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_autoscalingthresholds.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_autoscalingthresholds.go new file mode 100644 index 0000000000..62a7105a26 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_autoscalingthresholds.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSOpsWorksLayer_AutoScalingThresholds AWS CloudFormation Resource (AWS::OpsWorks::Layer.AutoScalingThresholds) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling-autoscalingthresholds.html +type AWSOpsWorksLayer_AutoScalingThresholds struct { + + // CpuThreshold AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling-autoscalingthresholds.html#cfn-opsworks-layer-loadbasedautoscaling-autoscalingthresholds-cputhreshold + CpuThreshold float64 `json:"CpuThreshold,omitempty"` + + // IgnoreMetricsTime AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling-autoscalingthresholds.html#cfn-opsworks-layer-loadbasedautoscaling-autoscalingthresholds-ignoremetricstime + IgnoreMetricsTime int `json:"IgnoreMetricsTime,omitempty"` + + // InstanceCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling-autoscalingthresholds.html#cfn-opsworks-layer-loadbasedautoscaling-autoscalingthresholds-instancecount + InstanceCount int `json:"InstanceCount,omitempty"` + + // LoadThreshold AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling-autoscalingthresholds.html#cfn-opsworks-layer-loadbasedautoscaling-autoscalingthresholds-loadthreshold + LoadThreshold float64 `json:"LoadThreshold,omitempty"` + + // MemoryThreshold AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling-autoscalingthresholds.html#cfn-opsworks-layer-loadbasedautoscaling-autoscalingthresholds-memorythreshold + MemoryThreshold float64 `json:"MemoryThreshold,omitempty"` + + // ThresholdsWaitTime AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling-autoscalingthresholds.html#cfn-opsworks-layer-loadbasedautoscaling-autoscalingthresholds-thresholdwaittime + ThresholdsWaitTime int `json:"ThresholdsWaitTime,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_AutoScalingThresholds) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.AutoScalingThresholds" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksLayer_AutoScalingThresholds) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_lifecycleeventconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_lifecycleeventconfiguration.go new file mode 100644 index 0000000000..524406f23c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_lifecycleeventconfiguration.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSOpsWorksLayer_LifecycleEventConfiguration AWS CloudFormation Resource (AWS::OpsWorks::Layer.LifecycleEventConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-lifecycleeventconfiguration.html +type AWSOpsWorksLayer_LifecycleEventConfiguration struct { + + // ShutdownEventConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-lifecycleeventconfiguration.html#cfn-opsworks-layer-lifecycleconfiguration-shutdowneventconfiguration + ShutdownEventConfiguration *AWSOpsWorksLayer_ShutdownEventConfiguration `json:"ShutdownEventConfiguration,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_LifecycleEventConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.LifecycleEventConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksLayer_LifecycleEventConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_loadbasedautoscaling.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_loadbasedautoscaling.go new file mode 100644 index 0000000000..d84904ef3a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_loadbasedautoscaling.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSOpsWorksLayer_LoadBasedAutoScaling AWS CloudFormation Resource (AWS::OpsWorks::Layer.LoadBasedAutoScaling) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling.html +type AWSOpsWorksLayer_LoadBasedAutoScaling struct { + + // DownScaling AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling.html#cfn-opsworks-layer-loadbasedautoscaling-downscaling + DownScaling *AWSOpsWorksLayer_AutoScalingThresholds `json:"DownScaling,omitempty"` + + // Enable AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling.html#cfn-opsworks-layer-loadbasedautoscaling-enable + Enable bool `json:"Enable,omitempty"` + + // UpScaling AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-loadbasedautoscaling.html#cfn-opsworks-layer-loadbasedautoscaling-upscaling + UpScaling *AWSOpsWorksLayer_AutoScalingThresholds `json:"UpScaling,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_LoadBasedAutoScaling) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.LoadBasedAutoScaling" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksLayer_LoadBasedAutoScaling) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_recipes.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_recipes.go new file mode 100644 index 0000000000..5243e3177d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_recipes.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSOpsWorksLayer_Recipes AWS CloudFormation Resource (AWS::OpsWorks::Layer.Recipes) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-recipes.html +type AWSOpsWorksLayer_Recipes struct { + + // Configure AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-recipes.html#cfn-opsworks-layer-customrecipes-configure + Configure []string `json:"Configure,omitempty"` + + // Deploy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-recipes.html#cfn-opsworks-layer-customrecipes-deploy + Deploy []string `json:"Deploy,omitempty"` + + // Setup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-recipes.html#cfn-opsworks-layer-customrecipes-setup + Setup []string `json:"Setup,omitempty"` + + // Shutdown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-recipes.html#cfn-opsworks-layer-customrecipes-shutdown + Shutdown []string `json:"Shutdown,omitempty"` + + // Undeploy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-recipes.html#cfn-opsworks-layer-customrecipes-undeploy + Undeploy []string `json:"Undeploy,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_Recipes) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.Recipes" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksLayer_Recipes) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_shutdowneventconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_shutdowneventconfiguration.go new file mode 100644 index 0000000000..ec2046f8e0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_shutdowneventconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSOpsWorksLayer_ShutdownEventConfiguration AWS CloudFormation Resource (AWS::OpsWorks::Layer.ShutdownEventConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-lifecycleeventconfiguration-shutdowneventconfiguration.html +type AWSOpsWorksLayer_ShutdownEventConfiguration struct { + + // DelayUntilElbConnectionsDrained AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-lifecycleeventconfiguration-shutdowneventconfiguration.html#cfn-opsworks-layer-lifecycleconfiguration-shutdowneventconfiguration-delayuntilelbconnectionsdrained + DelayUntilElbConnectionsDrained bool `json:"DelayUntilElbConnectionsDrained,omitempty"` + + // ExecutionTimeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-lifecycleeventconfiguration-shutdowneventconfiguration.html#cfn-opsworks-layer-lifecycleconfiguration-shutdowneventconfiguration-executiontimeout + ExecutionTimeout int `json:"ExecutionTimeout,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_ShutdownEventConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.ShutdownEventConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksLayer_ShutdownEventConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_volumeconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_volumeconfiguration.go new file mode 100644 index 0000000000..a4ccd6e439 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_volumeconfiguration.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSOpsWorksLayer_VolumeConfiguration AWS CloudFormation Resource (AWS::OpsWorks::Layer.VolumeConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-volumeconfiguration.html +type AWSOpsWorksLayer_VolumeConfiguration struct { + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-volumeconfiguration.html#cfn-opsworks-layer-volconfig-iops + Iops int `json:"Iops,omitempty"` + + // MountPoint AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-volumeconfiguration.html#cfn-opsworks-layer-volconfig-mountpoint + MountPoint string `json:"MountPoint,omitempty"` + + // NumberOfDisks AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-volumeconfiguration.html#cfn-opsworks-layer-volconfig-numberofdisks + NumberOfDisks int `json:"NumberOfDisks,omitempty"` + + // RaidLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-volumeconfiguration.html#cfn-opsworks-layer-volconfig-raidlevel + RaidLevel int `json:"RaidLevel,omitempty"` + + // Size AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-volumeconfiguration.html#cfn-opsworks-layer-volconfig-size + Size int `json:"Size,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-layer-volumeconfiguration.html#cfn-opsworks-layer-volconfig-volumetype + VolumeType string `json:"VolumeType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_VolumeConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.VolumeConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksLayer_VolumeConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack.go new file mode 100644 index 0000000000..0cfe98afe9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack.go @@ -0,0 +1,230 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSOpsWorksStack AWS CloudFormation Resource (AWS::OpsWorks::Stack) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html +type AWSOpsWorksStack struct { + + // AgentVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-agentversion + AgentVersion string `json:"AgentVersion,omitempty"` + + // Attributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-attributes + Attributes map[string]string `json:"Attributes,omitempty"` + + // ChefConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-chefconfiguration + ChefConfiguration *AWSOpsWorksStack_ChefConfiguration `json:"ChefConfiguration,omitempty"` + + // CloneAppIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-cloneappids + CloneAppIds []string `json:"CloneAppIds,omitempty"` + + // ClonePermissions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-clonepermissions + ClonePermissions bool `json:"ClonePermissions,omitempty"` + + // ConfigurationManager AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-configmanager + ConfigurationManager *AWSOpsWorksStack_StackConfigurationManager `json:"ConfigurationManager,omitempty"` + + // CustomCookbooksSource AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-custcookbooksource + CustomCookbooksSource *AWSOpsWorksStack_Source `json:"CustomCookbooksSource,omitempty"` + + // CustomJson AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-custjson + CustomJson interface{} `json:"CustomJson,omitempty"` + + // DefaultAvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-defaultaz + DefaultAvailabilityZone string `json:"DefaultAvailabilityZone,omitempty"` + + // DefaultInstanceProfileArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-defaultinstanceprof + DefaultInstanceProfileArn string `json:"DefaultInstanceProfileArn,omitempty"` + + // DefaultOs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-defaultos + DefaultOs string `json:"DefaultOs,omitempty"` + + // DefaultRootDeviceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-defaultrootdevicetype + DefaultRootDeviceType string `json:"DefaultRootDeviceType,omitempty"` + + // DefaultSshKeyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-defaultsshkeyname + DefaultSshKeyName string `json:"DefaultSshKeyName,omitempty"` + + // DefaultSubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#defaultsubnet + DefaultSubnetId string `json:"DefaultSubnetId,omitempty"` + + // EcsClusterArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-ecsclusterarn + EcsClusterArn string `json:"EcsClusterArn,omitempty"` + + // ElasticIps AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-elasticips + ElasticIps []AWSOpsWorksStack_ElasticIp `json:"ElasticIps,omitempty"` + + // HostnameTheme AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-hostnametheme + HostnameTheme string `json:"HostnameTheme,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-name + Name string `json:"Name,omitempty"` + + // RdsDbInstances AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-rdsdbinstances + RdsDbInstances []AWSOpsWorksStack_RdsDbInstance `json:"RdsDbInstances,omitempty"` + + // ServiceRoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-servicerolearn + ServiceRoleArn string `json:"ServiceRoleArn,omitempty"` + + // SourceStackId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-sourcestackid + SourceStackId string `json:"SourceStackId,omitempty"` + + // UseCustomCookbooks AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#usecustcookbooks + UseCustomCookbooks bool `json:"UseCustomCookbooks,omitempty"` + + // UseOpsworksSecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-useopsworkssecuritygroups + UseOpsworksSecurityGroups bool `json:"UseOpsworksSecurityGroups,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-vpcid + VpcId string `json:"VpcId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksStack) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSOpsWorksStack) MarshalJSON() ([]byte, error) { + type Properties AWSOpsWorksStack + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSOpsWorksStack) UnmarshalJSON(b []byte) error { + type Properties AWSOpsWorksStack + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSOpsWorksStack(*res.Properties) + } + + return nil +} + +// GetAllAWSOpsWorksStackResources retrieves all AWSOpsWorksStack items from an AWS CloudFormation template +func (t *Template) GetAllAWSOpsWorksStackResources() map[string]AWSOpsWorksStack { + results := map[string]AWSOpsWorksStack{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSOpsWorksStack: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::Stack" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksStack + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSOpsWorksStackWithName retrieves all AWSOpsWorksStack items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSOpsWorksStackWithName(name string) (AWSOpsWorksStack, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSOpsWorksStack: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::Stack" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksStack + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSOpsWorksStack{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_chefconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_chefconfiguration.go new file mode 100644 index 0000000000..76cf8069f9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_chefconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSOpsWorksStack_ChefConfiguration AWS CloudFormation Resource (AWS::OpsWorks::Stack.ChefConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-chefconfiguration.html +type AWSOpsWorksStack_ChefConfiguration struct { + + // BerkshelfVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-chefconfiguration.html#cfn-opsworks-chefconfiguration-berkshelfversion + BerkshelfVersion string `json:"BerkshelfVersion,omitempty"` + + // ManageBerkshelf AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-chefconfiguration.html#cfn-opsworks-chefconfiguration-berkshelfversion + ManageBerkshelf bool `json:"ManageBerkshelf,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_ChefConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.ChefConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksStack_ChefConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_elasticip.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_elasticip.go new file mode 100644 index 0000000000..29981baf4c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_elasticip.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSOpsWorksStack_ElasticIp AWS CloudFormation Resource (AWS::OpsWorks::Stack.ElasticIp) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-elasticip.html +type AWSOpsWorksStack_ElasticIp struct { + + // Ip AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-elasticip.html#cfn-opsworks-stack-elasticip-ip + Ip string `json:"Ip,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-elasticip.html#cfn-opsworks-stack-elasticip-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_ElasticIp) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.ElasticIp" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksStack_ElasticIp) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_rdsdbinstance.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_rdsdbinstance.go new file mode 100644 index 0000000000..dba0695e44 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_rdsdbinstance.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSOpsWorksStack_RdsDbInstance AWS CloudFormation Resource (AWS::OpsWorks::Stack.RdsDbInstance) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-rdsdbinstance.html +type AWSOpsWorksStack_RdsDbInstance struct { + + // DbPassword AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-rdsdbinstance.html#cfn-opsworks-stack-rdsdbinstance-dbpassword + DbPassword string `json:"DbPassword,omitempty"` + + // DbUser AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-rdsdbinstance.html#cfn-opsworks-stack-rdsdbinstance-dbuser + DbUser string `json:"DbUser,omitempty"` + + // RdsDbInstanceArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-rdsdbinstance.html#cfn-opsworks-stack-rdsdbinstance-rdsdbinstancearn + RdsDbInstanceArn string `json:"RdsDbInstanceArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_RdsDbInstance) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.RdsDbInstance" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksStack_RdsDbInstance) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_source.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_source.go new file mode 100644 index 0000000000..6408f7a41d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_source.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSOpsWorksStack_Source AWS CloudFormation Resource (AWS::OpsWorks::Stack.Source) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html +type AWSOpsWorksStack_Source struct { + + // Password AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-password + Password string `json:"Password,omitempty"` + + // Revision AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-revision + Revision string `json:"Revision,omitempty"` + + // SshKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-sshkey + SshKey string `json:"SshKey,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-type + Type string `json:"Type,omitempty"` + + // Url AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-url + Url string `json:"Url,omitempty"` + + // Username AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-source.html#cfn-opsworks-custcookbooksource-username + Username string `json:"Username,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_Source) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.Source" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksStack_Source) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_stackconfigurationmanager.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_stackconfigurationmanager.go new file mode 100644 index 0000000000..dc2d34d02e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_stackconfigurationmanager.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSOpsWorksStack_StackConfigurationManager AWS CloudFormation Resource (AWS::OpsWorks::Stack.StackConfigurationManager) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-stackconfigmanager.html +type AWSOpsWorksStack_StackConfigurationManager struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-stackconfigmanager.html#cfn-opsworks-configmanager-name + Name string `json:"Name,omitempty"` + + // Version AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opsworks-stack-stackconfigmanager.html#cfn-opsworks-configmanager-version + Version string `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_StackConfigurationManager) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.StackConfigurationManager" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksStack_StackConfigurationManager) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-userprofile.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-userprofile.go new file mode 100644 index 0000000000..7d1ee6f134 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-userprofile.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSOpsWorksUserProfile AWS CloudFormation Resource (AWS::OpsWorks::UserProfile) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-userprofile.html +type AWSOpsWorksUserProfile struct { + + // AllowSelfManagement AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-userprofile.html#cfn-opsworks-userprofile-allowselfmanagement + AllowSelfManagement bool `json:"AllowSelfManagement,omitempty"` + + // IamUserArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-userprofile.html#cfn-opsworks-userprofile-iamuserarn + IamUserArn string `json:"IamUserArn,omitempty"` + + // SshPublicKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-userprofile.html#cfn-opsworks-userprofile-sshpublickey + SshPublicKey string `json:"SshPublicKey,omitempty"` + + // SshUsername AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-userprofile.html#cfn-opsworks-userprofile-sshusername + SshUsername string `json:"SshUsername,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksUserProfile) AWSCloudFormationType() string { + return "AWS::OpsWorks::UserProfile" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksUserProfile) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSOpsWorksUserProfile) MarshalJSON() ([]byte, error) { + type Properties AWSOpsWorksUserProfile + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSOpsWorksUserProfile) UnmarshalJSON(b []byte) error { + type Properties AWSOpsWorksUserProfile + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSOpsWorksUserProfile(*res.Properties) + } + + return nil +} + +// GetAllAWSOpsWorksUserProfileResources retrieves all AWSOpsWorksUserProfile items from an AWS CloudFormation template +func (t *Template) GetAllAWSOpsWorksUserProfileResources() map[string]AWSOpsWorksUserProfile { + results := map[string]AWSOpsWorksUserProfile{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSOpsWorksUserProfile: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::UserProfile" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksUserProfile + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSOpsWorksUserProfileWithName retrieves all AWSOpsWorksUserProfile items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSOpsWorksUserProfileWithName(name string) (AWSOpsWorksUserProfile, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSOpsWorksUserProfile: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::UserProfile" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksUserProfile + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSOpsWorksUserProfile{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-volume.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-volume.go new file mode 100644 index 0000000000..4b1a20c726 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-volume.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSOpsWorksVolume AWS CloudFormation Resource (AWS::OpsWorks::Volume) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-volume.html +type AWSOpsWorksVolume struct { + + // Ec2VolumeId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-volume.html#cfn-opsworks-volume-ec2volumeid + Ec2VolumeId string `json:"Ec2VolumeId,omitempty"` + + // MountPoint AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-volume.html#cfn-opsworks-volume-mountpoint + MountPoint string `json:"MountPoint,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-volume.html#cfn-opsworks-volume-name + Name string `json:"Name,omitempty"` + + // StackId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-volume.html#cfn-opsworks-volume-stackid + StackId string `json:"StackId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksVolume) AWSCloudFormationType() string { + return "AWS::OpsWorks::Volume" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSOpsWorksVolume) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSOpsWorksVolume) MarshalJSON() ([]byte, error) { + type Properties AWSOpsWorksVolume + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSOpsWorksVolume) UnmarshalJSON(b []byte) error { + type Properties AWSOpsWorksVolume + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSOpsWorksVolume(*res.Properties) + } + + return nil +} + +// GetAllAWSOpsWorksVolumeResources retrieves all AWSOpsWorksVolume items from an AWS CloudFormation template +func (t *Template) GetAllAWSOpsWorksVolumeResources() map[string]AWSOpsWorksVolume { + results := map[string]AWSOpsWorksVolume{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSOpsWorksVolume: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::Volume" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksVolume + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSOpsWorksVolumeWithName retrieves all AWSOpsWorksVolume items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSOpsWorksVolumeWithName(name string) (AWSOpsWorksVolume, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSOpsWorksVolume: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::OpsWorks::Volume" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSOpsWorksVolume + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSOpsWorksVolume{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbcluster.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbcluster.go new file mode 100644 index 0000000000..7083619c7e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbcluster.go @@ -0,0 +1,200 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSDBCluster AWS CloudFormation Resource (AWS::RDS::DBCluster) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html +type AWSRDSDBCluster struct { + + // AvailabilityZones AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-availabilityzones + AvailabilityZones string `json:"AvailabilityZones,omitempty"` + + // BackupRetentionPeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-backuprententionperiod + BackupRetentionPeriod int `json:"BackupRetentionPeriod,omitempty"` + + // DBClusterParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-dbclusterparametergroupname + DBClusterParameterGroupName string `json:"DBClusterParameterGroupName,omitempty"` + + // DBSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-dbsubnetgroupname + DBSubnetGroupName string `json:"DBSubnetGroupName,omitempty"` + + // DatabaseName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-databasename + DatabaseName string `json:"DatabaseName,omitempty"` + + // Engine AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-engine + Engine string `json:"Engine,omitempty"` + + // EngineVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-engineversion + EngineVersion string `json:"EngineVersion,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // MasterUserPassword AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-masteruserpassword + MasterUserPassword string `json:"MasterUserPassword,omitempty"` + + // MasterUsername AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-masterusername + MasterUsername string `json:"MasterUsername,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-port + Port int `json:"Port,omitempty"` + + // PreferredBackupWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-preferredbackupwindow + PreferredBackupWindow string `json:"PreferredBackupWindow,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // ReplicationSourceIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-replicationsourceidentifier + ReplicationSourceIdentifier string `json:"ReplicationSourceIdentifier,omitempty"` + + // SnapshotIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-snapshotidentifier + SnapshotIdentifier string `json:"SnapshotIdentifier,omitempty"` + + // StorageEncrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-storageencrypted + StorageEncrypted bool `json:"StorageEncrypted,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcSecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-vpcsecuritygroupids + VpcSecurityGroupIds []string `json:"VpcSecurityGroupIds,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBCluster) AWSCloudFormationType() string { + return "AWS::RDS::DBCluster" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSDBCluster) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSDBCluster) MarshalJSON() ([]byte, error) { + type Properties AWSRDSDBCluster + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSDBCluster) UnmarshalJSON(b []byte) error { + type Properties AWSRDSDBCluster + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSDBCluster(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSDBClusterResources retrieves all AWSRDSDBCluster items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSDBClusterResources() map[string]AWSRDSDBCluster { + results := map[string]AWSRDSDBCluster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSDBCluster: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBCluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBCluster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSDBClusterWithName retrieves all AWSRDSDBCluster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSDBClusterWithName(name string) (AWSRDSDBCluster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSDBCluster: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBCluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBCluster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSDBCluster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbclusterparametergroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbclusterparametergroup.go new file mode 100644 index 0000000000..d2aec2d6a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbclusterparametergroup.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSDBClusterParameterGroup AWS CloudFormation Resource (AWS::RDS::DBClusterParameterGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbclusterparametergroup.html +type AWSRDSDBClusterParameterGroup struct { + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbclusterparametergroup.html#cfn-rds-dbclusterparametergroup-description + Description string `json:"Description,omitempty"` + + // Family AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbclusterparametergroup.html#cfn-rds-dbclusterparametergroup-family + Family string `json:"Family,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbclusterparametergroup.html#cfn-rds-dbclusterparametergroup-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbclusterparametergroup.html#cfn-rds-dbclusterparametergroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBClusterParameterGroup) AWSCloudFormationType() string { + return "AWS::RDS::DBClusterParameterGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSDBClusterParameterGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSDBClusterParameterGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRDSDBClusterParameterGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSDBClusterParameterGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRDSDBClusterParameterGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSDBClusterParameterGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSDBClusterParameterGroupResources retrieves all AWSRDSDBClusterParameterGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSDBClusterParameterGroupResources() map[string]AWSRDSDBClusterParameterGroup { + results := map[string]AWSRDSDBClusterParameterGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSDBClusterParameterGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBClusterParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBClusterParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSDBClusterParameterGroupWithName retrieves all AWSRDSDBClusterParameterGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSDBClusterParameterGroupWithName(name string) (AWSRDSDBClusterParameterGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSDBClusterParameterGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBClusterParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBClusterParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSDBClusterParameterGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbinstance.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbinstance.go new file mode 100644 index 0000000000..3536f3040c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbinstance.go @@ -0,0 +1,300 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSDBInstance AWS CloudFormation Resource (AWS::RDS::DBInstance) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html +type AWSRDSDBInstance struct { + + // AllocatedStorage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-allocatedstorage + AllocatedStorage string `json:"AllocatedStorage,omitempty"` + + // AllowMajorVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-allowmajorversionupgrade + AllowMajorVersionUpgrade bool `json:"AllowMajorVersionUpgrade,omitempty"` + + // AutoMinorVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-autominorversionupgrade + AutoMinorVersionUpgrade bool `json:"AutoMinorVersionUpgrade,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // BackupRetentionPeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-backupretentionperiod + BackupRetentionPeriod string `json:"BackupRetentionPeriod,omitempty"` + + // CharacterSetName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-charactersetname + CharacterSetName string `json:"CharacterSetName,omitempty"` + + // CopyTagsToSnapshot AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-copytagstosnapshot + CopyTagsToSnapshot bool `json:"CopyTagsToSnapshot,omitempty"` + + // DBClusterIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbclusteridentifier + DBClusterIdentifier string `json:"DBClusterIdentifier,omitempty"` + + // DBInstanceClass AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbinstanceclass + DBInstanceClass string `json:"DBInstanceClass,omitempty"` + + // DBInstanceIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbinstanceidentifier + DBInstanceIdentifier string `json:"DBInstanceIdentifier,omitempty"` + + // DBName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbname + DBName string `json:"DBName,omitempty"` + + // DBParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbparametergroupname + DBParameterGroupName string `json:"DBParameterGroupName,omitempty"` + + // DBSecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbsecuritygroups + DBSecurityGroups []string `json:"DBSecurityGroups,omitempty"` + + // DBSnapshotIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbsnapshotidentifier + DBSnapshotIdentifier string `json:"DBSnapshotIdentifier,omitempty"` + + // DBSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbsubnetgroupname + DBSubnetGroupName string `json:"DBSubnetGroupName,omitempty"` + + // Domain AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-domain + Domain string `json:"Domain,omitempty"` + + // DomainIAMRoleName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-domainiamrolename + DomainIAMRoleName string `json:"DomainIAMRoleName,omitempty"` + + // Engine AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-engine + Engine string `json:"Engine,omitempty"` + + // EngineVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-engineversion + EngineVersion string `json:"EngineVersion,omitempty"` + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-iops + Iops int `json:"Iops,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // LicenseModel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-licensemodel + LicenseModel string `json:"LicenseModel,omitempty"` + + // MasterUserPassword AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-masteruserpassword + MasterUserPassword string `json:"MasterUserPassword,omitempty"` + + // MasterUsername AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-masterusername + MasterUsername string `json:"MasterUsername,omitempty"` + + // MonitoringInterval AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-monitoringinterval + MonitoringInterval int `json:"MonitoringInterval,omitempty"` + + // MonitoringRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-monitoringrolearn + MonitoringRoleArn string `json:"MonitoringRoleArn,omitempty"` + + // MultiAZ AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-multiaz + MultiAZ bool `json:"MultiAZ,omitempty"` + + // OptionGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-optiongroupname + OptionGroupName string `json:"OptionGroupName,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-port + Port string `json:"Port,omitempty"` + + // PreferredBackupWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-preferredbackupwindow + PreferredBackupWindow string `json:"PreferredBackupWindow,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // PubliclyAccessible AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-publiclyaccessible + PubliclyAccessible bool `json:"PubliclyAccessible,omitempty"` + + // SourceDBInstanceIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-sourcedbinstanceidentifier + SourceDBInstanceIdentifier string `json:"SourceDBInstanceIdentifier,omitempty"` + + // StorageEncrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-storageencrypted + StorageEncrypted bool `json:"StorageEncrypted,omitempty"` + + // StorageType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-storagetype + StorageType string `json:"StorageType,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-tags + Tags []Tag `json:"Tags,omitempty"` + + // Timezone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-timezone + Timezone string `json:"Timezone,omitempty"` + + // VPCSecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-vpcsecuritygroups + VPCSecurityGroups []string `json:"VPCSecurityGroups,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBInstance) AWSCloudFormationType() string { + return "AWS::RDS::DBInstance" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSDBInstance) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSDBInstance) MarshalJSON() ([]byte, error) { + type Properties AWSRDSDBInstance + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSDBInstance) UnmarshalJSON(b []byte) error { + type Properties AWSRDSDBInstance + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSDBInstance(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSDBInstanceResources retrieves all AWSRDSDBInstance items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSDBInstanceResources() map[string]AWSRDSDBInstance { + results := map[string]AWSRDSDBInstance{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSDBInstance: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBInstance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBInstance + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSDBInstanceWithName retrieves all AWSRDSDBInstance items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSDBInstanceWithName(name string) (AWSRDSDBInstance, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSDBInstance: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBInstance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBInstance + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSDBInstance{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbparametergroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbparametergroup.go new file mode 100644 index 0000000000..7779863cbd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbparametergroup.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSDBParameterGroup AWS CloudFormation Resource (AWS::RDS::DBParameterGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbparametergroup.html +type AWSRDSDBParameterGroup struct { + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbparametergroup.html#cfn-rds-dbparametergroup-description + Description string `json:"Description,omitempty"` + + // Family AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbparametergroup.html#cfn-rds-dbparametergroup-family + Family string `json:"Family,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbparametergroup.html#cfn-rds-dbparametergroup-parameters + Parameters map[string]string `json:"Parameters,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbparametergroup.html#cfn-rds-dbparametergroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBParameterGroup) AWSCloudFormationType() string { + return "AWS::RDS::DBParameterGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSDBParameterGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSDBParameterGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRDSDBParameterGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSDBParameterGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRDSDBParameterGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSDBParameterGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSDBParameterGroupResources retrieves all AWSRDSDBParameterGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSDBParameterGroupResources() map[string]AWSRDSDBParameterGroup { + results := map[string]AWSRDSDBParameterGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSDBParameterGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSDBParameterGroupWithName retrieves all AWSRDSDBParameterGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSDBParameterGroupWithName(name string) (AWSRDSDBParameterGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSDBParameterGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSDBParameterGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroup.go new file mode 100644 index 0000000000..f2350cd650 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroup.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSDBSecurityGroup AWS CloudFormation Resource (AWS::RDS::DBSecurityGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group.html +type AWSRDSDBSecurityGroup struct { + + // DBSecurityGroupIngress AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group.html#cfn-rds-dbsecuritygroup-dbsecuritygroupingress + DBSecurityGroupIngress []AWSRDSDBSecurityGroup_Ingress `json:"DBSecurityGroupIngress,omitempty"` + + // EC2VpcId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group.html#cfn-rds-dbsecuritygroup-ec2vpcid + EC2VpcId string `json:"EC2VpcId,omitempty"` + + // GroupDescription AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group.html#cfn-rds-dbsecuritygroup-groupdescription + GroupDescription string `json:"GroupDescription,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group.html#cfn-rds-dbsecuritygroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBSecurityGroup) AWSCloudFormationType() string { + return "AWS::RDS::DBSecurityGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSDBSecurityGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSDBSecurityGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRDSDBSecurityGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSDBSecurityGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRDSDBSecurityGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSDBSecurityGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSDBSecurityGroupResources retrieves all AWSRDSDBSecurityGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSDBSecurityGroupResources() map[string]AWSRDSDBSecurityGroup { + results := map[string]AWSRDSDBSecurityGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSDBSecurityGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBSecurityGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBSecurityGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSDBSecurityGroupWithName retrieves all AWSRDSDBSecurityGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSDBSecurityGroupWithName(name string) (AWSRDSDBSecurityGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSDBSecurityGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBSecurityGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBSecurityGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSDBSecurityGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroup_ingress.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroup_ingress.go new file mode 100644 index 0000000000..fe3c21a723 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroup_ingress.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSRDSDBSecurityGroup_Ingress AWS CloudFormation Resource (AWS::RDS::DBSecurityGroup.Ingress) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group-rule.html +type AWSRDSDBSecurityGroup_Ingress struct { + + // CIDRIP AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group-rule.html#cfn-rds-securitygroup-cidrip + CIDRIP string `json:"CIDRIP,omitempty"` + + // EC2SecurityGroupId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group-rule.html#cfn-rds-securitygroup-ec2securitygroupid + EC2SecurityGroupId string `json:"EC2SecurityGroupId,omitempty"` + + // EC2SecurityGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group-rule.html#cfn-rds-securitygroup-ec2securitygroupname + EC2SecurityGroupName string `json:"EC2SecurityGroupName,omitempty"` + + // EC2SecurityGroupOwnerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group-rule.html#cfn-rds-securitygroup-ec2securitygroupownerid + EC2SecurityGroupOwnerId string `json:"EC2SecurityGroupOwnerId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBSecurityGroup_Ingress) AWSCloudFormationType() string { + return "AWS::RDS::DBSecurityGroup.Ingress" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSDBSecurityGroup_Ingress) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroupingress.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroupingress.go new file mode 100644 index 0000000000..bf16b976d3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroupingress.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSDBSecurityGroupIngress AWS CloudFormation Resource (AWS::RDS::DBSecurityGroupIngress) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-security-group-ingress.html +type AWSRDSDBSecurityGroupIngress struct { + + // CIDRIP AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-security-group-ingress.html#cfn-rds-securitygroup-ingress-cidrip + CIDRIP string `json:"CIDRIP,omitempty"` + + // DBSecurityGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-security-group-ingress.html#cfn-rds-securitygroup-ingress-dbsecuritygroupname + DBSecurityGroupName string `json:"DBSecurityGroupName,omitempty"` + + // EC2SecurityGroupId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-security-group-ingress.html#cfn-rds-securitygroup-ingress-ec2securitygroupid + EC2SecurityGroupId string `json:"EC2SecurityGroupId,omitempty"` + + // EC2SecurityGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-security-group-ingress.html#cfn-rds-securitygroup-ingress-ec2securitygroupname + EC2SecurityGroupName string `json:"EC2SecurityGroupName,omitempty"` + + // EC2SecurityGroupOwnerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-security-group-ingress.html#cfn-rds-securitygroup-ingress-ec2securitygroupownerid + EC2SecurityGroupOwnerId string `json:"EC2SecurityGroupOwnerId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBSecurityGroupIngress) AWSCloudFormationType() string { + return "AWS::RDS::DBSecurityGroupIngress" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSDBSecurityGroupIngress) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSDBSecurityGroupIngress) MarshalJSON() ([]byte, error) { + type Properties AWSRDSDBSecurityGroupIngress + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSDBSecurityGroupIngress) UnmarshalJSON(b []byte) error { + type Properties AWSRDSDBSecurityGroupIngress + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSDBSecurityGroupIngress(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSDBSecurityGroupIngressResources retrieves all AWSRDSDBSecurityGroupIngress items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSDBSecurityGroupIngressResources() map[string]AWSRDSDBSecurityGroupIngress { + results := map[string]AWSRDSDBSecurityGroupIngress{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSDBSecurityGroupIngress: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBSecurityGroupIngress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBSecurityGroupIngress + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSDBSecurityGroupIngressWithName retrieves all AWSRDSDBSecurityGroupIngress items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSDBSecurityGroupIngressWithName(name string) (AWSRDSDBSecurityGroupIngress, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSDBSecurityGroupIngress: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBSecurityGroupIngress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBSecurityGroupIngress + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSDBSecurityGroupIngress{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsubnetgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsubnetgroup.go new file mode 100644 index 0000000000..e23099ad87 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsubnetgroup.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSDBSubnetGroup AWS CloudFormation Resource (AWS::RDS::DBSubnetGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html +type AWSRDSDBSubnetGroup struct { + + // DBSubnetGroupDescription AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html#cfn-rds-dbsubnetgroup-dbsubnetgroupdescription + DBSubnetGroupDescription string `json:"DBSubnetGroupDescription,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html#cfn-rds-dbsubnetgroup-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html#cfn-rds-dbsubnetgroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBSubnetGroup) AWSCloudFormationType() string { + return "AWS::RDS::DBSubnetGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSDBSubnetGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSDBSubnetGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRDSDBSubnetGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSDBSubnetGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRDSDBSubnetGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSDBSubnetGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSDBSubnetGroupResources retrieves all AWSRDSDBSubnetGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSDBSubnetGroupResources() map[string]AWSRDSDBSubnetGroup { + results := map[string]AWSRDSDBSubnetGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSDBSubnetGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBSubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSDBSubnetGroupWithName retrieves all AWSRDSDBSubnetGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSDBSubnetGroupWithName(name string) (AWSRDSDBSubnetGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSDBSubnetGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::DBSubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSDBSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSDBSubnetGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-eventsubscription.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-eventsubscription.go new file mode 100644 index 0000000000..f3e1515501 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-eventsubscription.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSEventSubscription AWS CloudFormation Resource (AWS::RDS::EventSubscription) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-eventsubscription.html +type AWSRDSEventSubscription struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-eventsubscription.html#cfn-rds-eventsubscription-enabled + Enabled bool `json:"Enabled,omitempty"` + + // EventCategories AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-eventsubscription.html#cfn-rds-eventsubscription-eventcategories + EventCategories []string `json:"EventCategories,omitempty"` + + // SnsTopicArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-eventsubscription.html#cfn-rds-eventsubscription-snstopicarn + SnsTopicArn string `json:"SnsTopicArn,omitempty"` + + // SourceIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-eventsubscription.html#cfn-rds-eventsubscription-sourceids + SourceIds []string `json:"SourceIds,omitempty"` + + // SourceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-eventsubscription.html#cfn-rds-eventsubscription-sourcetype + SourceType string `json:"SourceType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSEventSubscription) AWSCloudFormationType() string { + return "AWS::RDS::EventSubscription" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSEventSubscription) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSEventSubscription) MarshalJSON() ([]byte, error) { + type Properties AWSRDSEventSubscription + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSEventSubscription) UnmarshalJSON(b []byte) error { + type Properties AWSRDSEventSubscription + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSEventSubscription(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSEventSubscriptionResources retrieves all AWSRDSEventSubscription items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSEventSubscriptionResources() map[string]AWSRDSEventSubscription { + results := map[string]AWSRDSEventSubscription{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSEventSubscription: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::EventSubscription" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSEventSubscription + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSEventSubscriptionWithName retrieves all AWSRDSEventSubscription items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSEventSubscriptionWithName(name string) (AWSRDSEventSubscription, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSEventSubscription: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::EventSubscription" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSEventSubscription + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSEventSubscription{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup.go new file mode 100644 index 0000000000..b0a45d68ec --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup.go @@ -0,0 +1,135 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRDSOptionGroup AWS CloudFormation Resource (AWS::RDS::OptionGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-optiongroup.html +type AWSRDSOptionGroup struct { + + // EngineName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-optiongroup.html#cfn-rds-optiongroup-enginename + EngineName string `json:"EngineName,omitempty"` + + // MajorEngineVersion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-optiongroup.html#cfn-rds-optiongroup-majorengineversion + MajorEngineVersion string `json:"MajorEngineVersion,omitempty"` + + // OptionConfigurations AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-optiongroup.html#cfn-rds-optiongroup-optionconfigurations + OptionConfigurations []AWSRDSOptionGroup_OptionConfiguration `json:"OptionConfigurations,omitempty"` + + // OptionGroupDescription AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-optiongroup.html#cfn-rds-optiongroup-optiongroupdescription + OptionGroupDescription string `json:"OptionGroupDescription,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-optiongroup.html#cfn-rds-optiongroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSOptionGroup) AWSCloudFormationType() string { + return "AWS::RDS::OptionGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSOptionGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRDSOptionGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRDSOptionGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRDSOptionGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRDSOptionGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRDSOptionGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRDSOptionGroupResources retrieves all AWSRDSOptionGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRDSOptionGroupResources() map[string]AWSRDSOptionGroup { + results := map[string]AWSRDSOptionGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRDSOptionGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::OptionGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSOptionGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRDSOptionGroupWithName retrieves all AWSRDSOptionGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRDSOptionGroupWithName(name string) (AWSRDSOptionGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRDSOptionGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::RDS::OptionGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRDSOptionGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRDSOptionGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup_optionconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup_optionconfiguration.go new file mode 100644 index 0000000000..2f751a7b48 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup_optionconfiguration.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSRDSOptionGroup_OptionConfiguration AWS CloudFormation Resource (AWS::RDS::OptionGroup.OptionConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations.html +type AWSRDSOptionGroup_OptionConfiguration struct { + + // DBSecurityGroupMemberships AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations.html#cfn-rds-optiongroup-optionconfigurations-dbsecuritygroupmemberships + DBSecurityGroupMemberships []string `json:"DBSecurityGroupMemberships,omitempty"` + + // OptionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations.html#cfn-rds-optiongroup-optionconfigurations-optionname + OptionName string `json:"OptionName,omitempty"` + + // OptionSettings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations.html#cfn-rds-optiongroup-optionconfigurations-optionsettings + OptionSettings *AWSRDSOptionGroup_OptionSetting `json:"OptionSettings,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations.html#cfn-rds-optiongroup-optionconfigurations-port + Port int `json:"Port,omitempty"` + + // VpcSecurityGroupMemberships AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations.html#cfn-rds-optiongroup-optionconfigurations-vpcsecuritygroupmemberships + VpcSecurityGroupMemberships []string `json:"VpcSecurityGroupMemberships,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSOptionGroup_OptionConfiguration) AWSCloudFormationType() string { + return "AWS::RDS::OptionGroup.OptionConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSOptionGroup_OptionConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup_optionsetting.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup_optionsetting.go new file mode 100644 index 0000000000..d69937b946 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup_optionsetting.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSRDSOptionGroup_OptionSetting AWS CloudFormation Resource (AWS::RDS::OptionGroup.OptionSetting) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations-optionsettings.html +type AWSRDSOptionGroup_OptionSetting struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations-optionsettings.html#cfn-rds-optiongroup-optionconfigurations-optionsettings-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations-optionsettings.html#cfn-rds-optiongroup-optionconfigurations-optionsettings-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSOptionGroup_OptionSetting) AWSCloudFormationType() string { + return "AWS::RDS::OptionGroup.OptionSetting" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRDSOptionGroup_OptionSetting) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-cluster.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-cluster.go new file mode 100644 index 0000000000..ca4768a4cb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-cluster.go @@ -0,0 +1,250 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRedshiftCluster AWS CloudFormation Resource (AWS::Redshift::Cluster) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html +type AWSRedshiftCluster struct { + + // AllowVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-allowversionupgrade + AllowVersionUpgrade bool `json:"AllowVersionUpgrade,omitempty"` + + // AutomatedSnapshotRetentionPeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-automatedsnapshotretentionperiod + AutomatedSnapshotRetentionPeriod int `json:"AutomatedSnapshotRetentionPeriod,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // ClusterParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-clusterparametergroupname + ClusterParameterGroupName string `json:"ClusterParameterGroupName,omitempty"` + + // ClusterSecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-clustersecuritygroups + ClusterSecurityGroups []string `json:"ClusterSecurityGroups,omitempty"` + + // ClusterSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-clustersubnetgroupname + ClusterSubnetGroupName string `json:"ClusterSubnetGroupName,omitempty"` + + // ClusterType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-clustertype + ClusterType string `json:"ClusterType,omitempty"` + + // ClusterVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-clusterversion + ClusterVersion string `json:"ClusterVersion,omitempty"` + + // DBName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-dbname + DBName string `json:"DBName,omitempty"` + + // ElasticIp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-elasticip + ElasticIp string `json:"ElasticIp,omitempty"` + + // Encrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-encrypted + Encrypted bool `json:"Encrypted,omitempty"` + + // HsmClientCertificateIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-hsmclientcertidentifier + HsmClientCertificateIdentifier string `json:"HsmClientCertificateIdentifier,omitempty"` + + // HsmConfigurationIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-HsmConfigurationIdentifier + HsmConfigurationIdentifier string `json:"HsmConfigurationIdentifier,omitempty"` + + // IamRoles AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-iamroles + IamRoles []string `json:"IamRoles,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // LoggingProperties AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-loggingproperties + LoggingProperties *AWSRedshiftCluster_LoggingProperties `json:"LoggingProperties,omitempty"` + + // MasterUserPassword AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-masteruserpassword + MasterUserPassword string `json:"MasterUserPassword,omitempty"` + + // MasterUsername AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-masterusername + MasterUsername string `json:"MasterUsername,omitempty"` + + // NodeType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-nodetype + NodeType string `json:"NodeType,omitempty"` + + // NumberOfNodes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-nodetype + NumberOfNodes int `json:"NumberOfNodes,omitempty"` + + // OwnerAccount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-owneraccount + OwnerAccount string `json:"OwnerAccount,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-port + Port int `json:"Port,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // PubliclyAccessible AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-publiclyaccessible + PubliclyAccessible bool `json:"PubliclyAccessible,omitempty"` + + // SnapshotClusterIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-snapshotclusteridentifier + SnapshotClusterIdentifier string `json:"SnapshotClusterIdentifier,omitempty"` + + // SnapshotIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-snapshotidentifier + SnapshotIdentifier string `json:"SnapshotIdentifier,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcSecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-vpcsecuritygroupids + VpcSecurityGroupIds []string `json:"VpcSecurityGroupIds,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftCluster) AWSCloudFormationType() string { + return "AWS::Redshift::Cluster" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRedshiftCluster) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRedshiftCluster) MarshalJSON() ([]byte, error) { + type Properties AWSRedshiftCluster + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRedshiftCluster) UnmarshalJSON(b []byte) error { + type Properties AWSRedshiftCluster + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRedshiftCluster(*res.Properties) + } + + return nil +} + +// GetAllAWSRedshiftClusterResources retrieves all AWSRedshiftCluster items from an AWS CloudFormation template +func (t *Template) GetAllAWSRedshiftClusterResources() map[string]AWSRedshiftCluster { + results := map[string]AWSRedshiftCluster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRedshiftCluster: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftCluster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRedshiftClusterWithName retrieves all AWSRedshiftCluster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRedshiftClusterWithName(name string) (AWSRedshiftCluster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRedshiftCluster: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftCluster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRedshiftCluster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-cluster_loggingproperties.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-cluster_loggingproperties.go new file mode 100644 index 0000000000..da66225cef --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-cluster_loggingproperties.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSRedshiftCluster_LoggingProperties AWS CloudFormation Resource (AWS::Redshift::Cluster.LoggingProperties) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-redshift-cluster-loggingproperties.html +type AWSRedshiftCluster_LoggingProperties struct { + + // BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-redshift-cluster-loggingproperties.html#cfn-redshift-cluster-loggingproperties-bucketname + BucketName string `json:"BucketName,omitempty"` + + // S3KeyPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-redshift-cluster-loggingproperties.html#cfn-redshift-cluster-loggingproperties-s3keyprefix + S3KeyPrefix string `json:"S3KeyPrefix,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftCluster_LoggingProperties) AWSCloudFormationType() string { + return "AWS::Redshift::Cluster.LoggingProperties" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRedshiftCluster_LoggingProperties) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clusterparametergroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clusterparametergroup.go new file mode 100644 index 0000000000..d2923deccd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clusterparametergroup.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRedshiftClusterParameterGroup AWS CloudFormation Resource (AWS::Redshift::ClusterParameterGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clusterparametergroup.html +type AWSRedshiftClusterParameterGroup struct { + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clusterparametergroup.html#cfn-redshift-clusterparametergroup-description + Description string `json:"Description,omitempty"` + + // ParameterGroupFamily AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clusterparametergroup.html#cfn-redshift-clusterparametergroup-parametergroupfamily + ParameterGroupFamily string `json:"ParameterGroupFamily,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clusterparametergroup.html#cfn-redshift-clusterparametergroup-parameters + Parameters []AWSRedshiftClusterParameterGroup_Parameter `json:"Parameters,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clusterparametergroup.html#cfn-redshift-clusterparametergroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterParameterGroup) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterParameterGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRedshiftClusterParameterGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRedshiftClusterParameterGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRedshiftClusterParameterGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRedshiftClusterParameterGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRedshiftClusterParameterGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRedshiftClusterParameterGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRedshiftClusterParameterGroupResources retrieves all AWSRedshiftClusterParameterGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRedshiftClusterParameterGroupResources() map[string]AWSRedshiftClusterParameterGroup { + results := map[string]AWSRedshiftClusterParameterGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRedshiftClusterParameterGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::ClusterParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftClusterParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRedshiftClusterParameterGroupWithName retrieves all AWSRedshiftClusterParameterGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRedshiftClusterParameterGroupWithName(name string) (AWSRedshiftClusterParameterGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRedshiftClusterParameterGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::ClusterParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftClusterParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRedshiftClusterParameterGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clusterparametergroup_parameter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clusterparametergroup_parameter.go new file mode 100644 index 0000000000..52967a6b7b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clusterparametergroup_parameter.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSRedshiftClusterParameterGroup_Parameter AWS CloudFormation Resource (AWS::Redshift::ClusterParameterGroup.Parameter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-property-redshift-clusterparametergroup-parameter.html +type AWSRedshiftClusterParameterGroup_Parameter struct { + + // ParameterName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-property-redshift-clusterparametergroup-parameter.html#cfn-redshift-clusterparametergroup-parameter-parametername + ParameterName string `json:"ParameterName,omitempty"` + + // ParameterValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-property-redshift-clusterparametergroup-parameter.html#cfn-redshift-clusterparametergroup-parameter-parametervalue + ParameterValue string `json:"ParameterValue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterParameterGroup_Parameter) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterParameterGroup.Parameter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRedshiftClusterParameterGroup_Parameter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersecuritygroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersecuritygroup.go new file mode 100644 index 0000000000..192c4ded54 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersecuritygroup.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRedshiftClusterSecurityGroup AWS CloudFormation Resource (AWS::Redshift::ClusterSecurityGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroup.html +type AWSRedshiftClusterSecurityGroup struct { + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroup.html#cfn-redshift-clustersecuritygroup-description + Description string `json:"Description,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroup.html#cfn-redshift-clustersecuritygroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterSecurityGroup) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterSecurityGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRedshiftClusterSecurityGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRedshiftClusterSecurityGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRedshiftClusterSecurityGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRedshiftClusterSecurityGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRedshiftClusterSecurityGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRedshiftClusterSecurityGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRedshiftClusterSecurityGroupResources retrieves all AWSRedshiftClusterSecurityGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRedshiftClusterSecurityGroupResources() map[string]AWSRedshiftClusterSecurityGroup { + results := map[string]AWSRedshiftClusterSecurityGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRedshiftClusterSecurityGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::ClusterSecurityGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftClusterSecurityGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRedshiftClusterSecurityGroupWithName retrieves all AWSRedshiftClusterSecurityGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRedshiftClusterSecurityGroupWithName(name string) (AWSRedshiftClusterSecurityGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRedshiftClusterSecurityGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::ClusterSecurityGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftClusterSecurityGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRedshiftClusterSecurityGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersecuritygroupingress.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersecuritygroupingress.go new file mode 100644 index 0000000000..f693fd5585 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersecuritygroupingress.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRedshiftClusterSecurityGroupIngress AWS CloudFormation Resource (AWS::Redshift::ClusterSecurityGroupIngress) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroupingress.html +type AWSRedshiftClusterSecurityGroupIngress struct { + + // CIDRIP AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroupingress.html#cfn-redshift-clustersecuritygroupingress-cidrip + CIDRIP string `json:"CIDRIP,omitempty"` + + // ClusterSecurityGroupName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroupingress.html#cfn-redshift-clustersecuritygroupingress-clustersecuritygroupname + ClusterSecurityGroupName string `json:"ClusterSecurityGroupName,omitempty"` + + // EC2SecurityGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroupingress.html#cfn-redshift-clustersecuritygroupingress-ec2securitygroupname + EC2SecurityGroupName string `json:"EC2SecurityGroupName,omitempty"` + + // EC2SecurityGroupOwnerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroupingress.html#cfn-redshift-clustersecuritygroupingress-ec2securitygroupownerid + EC2SecurityGroupOwnerId string `json:"EC2SecurityGroupOwnerId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterSecurityGroupIngress) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterSecurityGroupIngress" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRedshiftClusterSecurityGroupIngress) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRedshiftClusterSecurityGroupIngress) MarshalJSON() ([]byte, error) { + type Properties AWSRedshiftClusterSecurityGroupIngress + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRedshiftClusterSecurityGroupIngress) UnmarshalJSON(b []byte) error { + type Properties AWSRedshiftClusterSecurityGroupIngress + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRedshiftClusterSecurityGroupIngress(*res.Properties) + } + + return nil +} + +// GetAllAWSRedshiftClusterSecurityGroupIngressResources retrieves all AWSRedshiftClusterSecurityGroupIngress items from an AWS CloudFormation template +func (t *Template) GetAllAWSRedshiftClusterSecurityGroupIngressResources() map[string]AWSRedshiftClusterSecurityGroupIngress { + results := map[string]AWSRedshiftClusterSecurityGroupIngress{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRedshiftClusterSecurityGroupIngress: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::ClusterSecurityGroupIngress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftClusterSecurityGroupIngress + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRedshiftClusterSecurityGroupIngressWithName retrieves all AWSRedshiftClusterSecurityGroupIngress items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRedshiftClusterSecurityGroupIngressWithName(name string) (AWSRedshiftClusterSecurityGroupIngress, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRedshiftClusterSecurityGroupIngress: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::ClusterSecurityGroupIngress" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftClusterSecurityGroupIngress + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRedshiftClusterSecurityGroupIngress{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersubnetgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersubnetgroup.go new file mode 100644 index 0000000000..19a270e10f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersubnetgroup.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRedshiftClusterSubnetGroup AWS CloudFormation Resource (AWS::Redshift::ClusterSubnetGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html +type AWSRedshiftClusterSubnetGroup struct { + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html#cfn-redshift-clustersubnetgroup-description + Description string `json:"Description,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html#cfn-redshift-clustersubnetgroup-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html#cfn-redshift-clustersubnetgroup-tags + Tags []Tag `json:"Tags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterSubnetGroup) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterSubnetGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRedshiftClusterSubnetGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRedshiftClusterSubnetGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRedshiftClusterSubnetGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRedshiftClusterSubnetGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRedshiftClusterSubnetGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRedshiftClusterSubnetGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRedshiftClusterSubnetGroupResources retrieves all AWSRedshiftClusterSubnetGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRedshiftClusterSubnetGroupResources() map[string]AWSRedshiftClusterSubnetGroup { + results := map[string]AWSRedshiftClusterSubnetGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRedshiftClusterSubnetGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::ClusterSubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftClusterSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRedshiftClusterSubnetGroupWithName retrieves all AWSRedshiftClusterSubnetGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRedshiftClusterSubnetGroupWithName(name string) (AWSRedshiftClusterSubnetGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRedshiftClusterSubnetGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Redshift::ClusterSubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRedshiftClusterSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRedshiftClusterSubnetGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck.go new file mode 100644 index 0000000000..7a753c42ff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRoute53HealthCheck AWS CloudFormation Resource (AWS::Route53::HealthCheck) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-healthcheck.html +type AWSRoute53HealthCheck struct { + + // HealthCheckConfig AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-healthcheck.html#cfn-route53-healthcheck-healthcheckconfig + HealthCheckConfig *AWSRoute53HealthCheck_HealthCheckConfig `json:"HealthCheckConfig,omitempty"` + + // HealthCheckTags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-healthcheck.html#cfn-route53-healthcheck-healthchecktags + HealthCheckTags []AWSRoute53HealthCheck_HealthCheckTag `json:"HealthCheckTags,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HealthCheck) AWSCloudFormationType() string { + return "AWS::Route53::HealthCheck" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53HealthCheck) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRoute53HealthCheck) MarshalJSON() ([]byte, error) { + type Properties AWSRoute53HealthCheck + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRoute53HealthCheck) UnmarshalJSON(b []byte) error { + type Properties AWSRoute53HealthCheck + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRoute53HealthCheck(*res.Properties) + } + + return nil +} + +// GetAllAWSRoute53HealthCheckResources retrieves all AWSRoute53HealthCheck items from an AWS CloudFormation template +func (t *Template) GetAllAWSRoute53HealthCheckResources() map[string]AWSRoute53HealthCheck { + results := map[string]AWSRoute53HealthCheck{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRoute53HealthCheck: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Route53::HealthCheck" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRoute53HealthCheck + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRoute53HealthCheckWithName retrieves all AWSRoute53HealthCheck items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRoute53HealthCheckWithName(name string) (AWSRoute53HealthCheck, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRoute53HealthCheck: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Route53::HealthCheck" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRoute53HealthCheck + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRoute53HealthCheck{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_alarmidentifier.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_alarmidentifier.go new file mode 100644 index 0000000000..323f6e18de --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_alarmidentifier.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSRoute53HealthCheck_AlarmIdentifier AWS CloudFormation Resource (AWS::Route53::HealthCheck.AlarmIdentifier) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-alarmidentifier.html +type AWSRoute53HealthCheck_AlarmIdentifier struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-alarmidentifier.html#cfn-route53-healthcheck-alarmidentifier-name + Name string `json:"Name,omitempty"` + + // Region AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-alarmidentifier.html#cfn-route53-healthcheck-alarmidentifier-region + Region string `json:"Region,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HealthCheck_AlarmIdentifier) AWSCloudFormationType() string { + return "AWS::Route53::HealthCheck.AlarmIdentifier" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53HealthCheck_AlarmIdentifier) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_healthcheckconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_healthcheckconfig.go new file mode 100644 index 0000000000..e5992a874a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_healthcheckconfig.go @@ -0,0 +1,91 @@ +package cloudformation + +// AWSRoute53HealthCheck_HealthCheckConfig AWS CloudFormation Resource (AWS::Route53::HealthCheck.HealthCheckConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html +type AWSRoute53HealthCheck_HealthCheckConfig struct { + + // AlarmIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-alarmidentifier + AlarmIdentifier *AWSRoute53HealthCheck_AlarmIdentifier `json:"AlarmIdentifier,omitempty"` + + // ChildHealthChecks AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-childhealthchecks + ChildHealthChecks []string `json:"ChildHealthChecks,omitempty"` + + // EnableSNI AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-enablesni + EnableSNI bool `json:"EnableSNI,omitempty"` + + // FailureThreshold AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-failurethreshold + FailureThreshold int `json:"FailureThreshold,omitempty"` + + // FullyQualifiedDomainName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-fullyqualifieddomainname + FullyQualifiedDomainName string `json:"FullyQualifiedDomainName,omitempty"` + + // HealthThreshold AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-healththreshold + HealthThreshold int `json:"HealthThreshold,omitempty"` + + // IPAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-ipaddress + IPAddress string `json:"IPAddress,omitempty"` + + // InsufficientDataHealthStatus AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-insufficientdatahealthstatus + InsufficientDataHealthStatus string `json:"InsufficientDataHealthStatus,omitempty"` + + // Inverted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-inverted + Inverted bool `json:"Inverted,omitempty"` + + // MeasureLatency AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-measurelatency + MeasureLatency bool `json:"MeasureLatency,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-port + Port int `json:"Port,omitempty"` + + // RequestInterval AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-requestinterval + RequestInterval int `json:"RequestInterval,omitempty"` + + // ResourcePath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-resourcepath + ResourcePath string `json:"ResourcePath,omitempty"` + + // SearchString AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-searchstring + SearchString string `json:"SearchString,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HealthCheck_HealthCheckConfig) AWSCloudFormationType() string { + return "AWS::Route53::HealthCheck.HealthCheckConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53HealthCheck_HealthCheckConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_healthchecktag.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_healthchecktag.go new file mode 100644 index 0000000000..7e11f43b6e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_healthchecktag.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSRoute53HealthCheck_HealthCheckTag AWS CloudFormation Resource (AWS::Route53::HealthCheck.HealthCheckTag) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthchecktag.html +type AWSRoute53HealthCheck_HealthCheckTag struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthchecktag.html#cfn-route53-healthchecktags-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthchecktag.html#cfn-route53-healthchecktags-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HealthCheck_HealthCheckTag) AWSCloudFormationType() string { + return "AWS::Route53::HealthCheck.HealthCheckTag" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53HealthCheck_HealthCheckTag) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone.go new file mode 100644 index 0000000000..d1e8558b41 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRoute53HostedZone AWS CloudFormation Resource (AWS::Route53::HostedZone) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone.html +type AWSRoute53HostedZone struct { + + // HostedZoneConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone.html#cfn-route53-hostedzone-hostedzoneconfig + HostedZoneConfig *AWSRoute53HostedZone_HostedZoneConfig `json:"HostedZoneConfig,omitempty"` + + // HostedZoneTags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone.html#cfn-route53-hostedzone-hostedzonetags + HostedZoneTags []AWSRoute53HostedZone_HostedZoneTag `json:"HostedZoneTags,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone.html#cfn-route53-hostedzone-name + Name string `json:"Name,omitempty"` + + // VPCs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone.html#cfn-route53-hostedzone-vpcs + VPCs []AWSRoute53HostedZone_VPC `json:"VPCs,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53HostedZone) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRoute53HostedZone) MarshalJSON() ([]byte, error) { + type Properties AWSRoute53HostedZone + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRoute53HostedZone) UnmarshalJSON(b []byte) error { + type Properties AWSRoute53HostedZone + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRoute53HostedZone(*res.Properties) + } + + return nil +} + +// GetAllAWSRoute53HostedZoneResources retrieves all AWSRoute53HostedZone items from an AWS CloudFormation template +func (t *Template) GetAllAWSRoute53HostedZoneResources() map[string]AWSRoute53HostedZone { + results := map[string]AWSRoute53HostedZone{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRoute53HostedZone: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Route53::HostedZone" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRoute53HostedZone + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRoute53HostedZoneWithName retrieves all AWSRoute53HostedZone items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRoute53HostedZoneWithName(name string) (AWSRoute53HostedZone, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRoute53HostedZone: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Route53::HostedZone" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRoute53HostedZone + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRoute53HostedZone{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_hostedzoneconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_hostedzoneconfig.go new file mode 100644 index 0000000000..fca646a1c6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_hostedzoneconfig.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSRoute53HostedZone_HostedZoneConfig AWS CloudFormation Resource (AWS::Route53::HostedZone.HostedZoneConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-hostedzone-hostedzoneconfig.html +type AWSRoute53HostedZone_HostedZoneConfig struct { + + // Comment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-hostedzone-hostedzoneconfig.html#cfn-route53-hostedzone-hostedzoneconfig-comment + Comment string `json:"Comment,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone_HostedZoneConfig) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone.HostedZoneConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53HostedZone_HostedZoneConfig) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_hostedzonetag.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_hostedzonetag.go new file mode 100644 index 0000000000..7a32395a71 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_hostedzonetag.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSRoute53HostedZone_HostedZoneTag AWS CloudFormation Resource (AWS::Route53::HostedZone.HostedZoneTag) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-hostedzone-hostedzonetags.html +type AWSRoute53HostedZone_HostedZoneTag struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-hostedzone-hostedzonetags.html#cfn-route53-hostedzonetags-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-hostedzone-hostedzonetags.html#cfn-route53-hostedzonetags-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone_HostedZoneTag) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone.HostedZoneTag" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53HostedZone_HostedZoneTag) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_vpc.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_vpc.go new file mode 100644 index 0000000000..23081eab3f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_vpc.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSRoute53HostedZone_VPC AWS CloudFormation Resource (AWS::Route53::HostedZone.VPC) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone-hostedzonevpcs.html +type AWSRoute53HostedZone_VPC struct { + + // VPCId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone-hostedzonevpcs.html#cfn-route53-hostedzone-hostedzonevpcs-vpcid + VPCId string `json:"VPCId,omitempty"` + + // VPCRegion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone-hostedzonevpcs.html#cfn-route53-hostedzone-hostedzonevpcs-vpcregion + VPCRegion string `json:"VPCRegion,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone_VPC) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone.VPC" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53HostedZone_VPC) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset.go new file mode 100644 index 0000000000..9f0ca47cd3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset.go @@ -0,0 +1,180 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRoute53RecordSet AWS CloudFormation Resource (AWS::Route53::RecordSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html +type AWSRoute53RecordSet struct { + + // AliasTarget AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-aliastarget + AliasTarget *AWSRoute53RecordSet_AliasTarget `json:"AliasTarget,omitempty"` + + // Comment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-comment + Comment string `json:"Comment,omitempty"` + + // Failover AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-failover + Failover string `json:"Failover,omitempty"` + + // GeoLocation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-geolocation + GeoLocation *AWSRoute53RecordSet_GeoLocation `json:"GeoLocation,omitempty"` + + // HealthCheckId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-healthcheckid + HealthCheckId string `json:"HealthCheckId,omitempty"` + + // HostedZoneId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-hostedzoneid + HostedZoneId string `json:"HostedZoneId,omitempty"` + + // HostedZoneName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-hostedzonename + HostedZoneName string `json:"HostedZoneName,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-name + Name string `json:"Name,omitempty"` + + // Region AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-region + Region string `json:"Region,omitempty"` + + // ResourceRecords AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-resourcerecords + ResourceRecords []string `json:"ResourceRecords,omitempty"` + + // SetIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-setidentifier + SetIdentifier string `json:"SetIdentifier,omitempty"` + + // TTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-ttl + TTL string `json:"TTL,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-type + Type string `json:"Type,omitempty"` + + // Weight AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-weight + Weight int `json:"Weight,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSet) AWSCloudFormationType() string { + return "AWS::Route53::RecordSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53RecordSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRoute53RecordSet) MarshalJSON() ([]byte, error) { + type Properties AWSRoute53RecordSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRoute53RecordSet) UnmarshalJSON(b []byte) error { + type Properties AWSRoute53RecordSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRoute53RecordSet(*res.Properties) + } + + return nil +} + +// GetAllAWSRoute53RecordSetResources retrieves all AWSRoute53RecordSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSRoute53RecordSetResources() map[string]AWSRoute53RecordSet { + results := map[string]AWSRoute53RecordSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRoute53RecordSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Route53::RecordSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRoute53RecordSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRoute53RecordSetWithName retrieves all AWSRoute53RecordSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRoute53RecordSetWithName(name string) (AWSRoute53RecordSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRoute53RecordSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Route53::RecordSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRoute53RecordSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRoute53RecordSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset_aliastarget.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset_aliastarget.go new file mode 100644 index 0000000000..5f33388ed2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset_aliastarget.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSRoute53RecordSet_AliasTarget AWS CloudFormation Resource (AWS::Route53::RecordSet.AliasTarget) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html +type AWSRoute53RecordSet_AliasTarget struct { + + // DNSName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-dnshostname + DNSName string `json:"DNSName,omitempty"` + + // EvaluateTargetHealth AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-evaluatetargethealth + EvaluateTargetHealth bool `json:"EvaluateTargetHealth,omitempty"` + + // HostedZoneId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-hostedzoneid + HostedZoneId string `json:"HostedZoneId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSet_AliasTarget) AWSCloudFormationType() string { + return "AWS::Route53::RecordSet.AliasTarget" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53RecordSet_AliasTarget) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset_geolocation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset_geolocation.go new file mode 100644 index 0000000000..98b1e6f3fb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset_geolocation.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSRoute53RecordSet_GeoLocation AWS CloudFormation Resource (AWS::Route53::RecordSet.GeoLocation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-geolocation.html +type AWSRoute53RecordSet_GeoLocation struct { + + // ContinentCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-geolocation.html#cfn-route53-recordset-geolocation-continentcode + ContinentCode string `json:"ContinentCode,omitempty"` + + // CountryCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-geolocation.html#cfn-route53-recordset-geolocation-countrycode + CountryCode string `json:"CountryCode,omitempty"` + + // SubdivisionCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-geolocation.html#cfn-route53-recordset-geolocation-subdivisioncode + SubdivisionCode string `json:"SubdivisionCode,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSet_GeoLocation) AWSCloudFormationType() string { + return "AWS::Route53::RecordSet.GeoLocation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53RecordSet_GeoLocation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup.go new file mode 100644 index 0000000000..ac41dbb538 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSRoute53RecordSetGroup AWS CloudFormation Resource (AWS::Route53::RecordSetGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-recordsetgroup.html +type AWSRoute53RecordSetGroup struct { + + // Comment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-recordsetgroup.html#cfn-route53-recordsetgroup-comment + Comment string `json:"Comment,omitempty"` + + // HostedZoneId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-recordsetgroup.html#cfn-route53-recordsetgroup-hostedzoneid + HostedZoneId string `json:"HostedZoneId,omitempty"` + + // HostedZoneName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-recordsetgroup.html#cfn-route53-recordsetgroup-hostedzonename + HostedZoneName string `json:"HostedZoneName,omitempty"` + + // RecordSets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-recordsetgroup.html#cfn-route53-recordsetgroup-recordsets + RecordSets []AWSRoute53RecordSetGroup_RecordSet `json:"RecordSets,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSetGroup) AWSCloudFormationType() string { + return "AWS::Route53::RecordSetGroup" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53RecordSetGroup) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSRoute53RecordSetGroup) MarshalJSON() ([]byte, error) { + type Properties AWSRoute53RecordSetGroup + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSRoute53RecordSetGroup) UnmarshalJSON(b []byte) error { + type Properties AWSRoute53RecordSetGroup + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSRoute53RecordSetGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSRoute53RecordSetGroupResources retrieves all AWSRoute53RecordSetGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSRoute53RecordSetGroupResources() map[string]AWSRoute53RecordSetGroup { + results := map[string]AWSRoute53RecordSetGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSRoute53RecordSetGroup: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Route53::RecordSetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRoute53RecordSetGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSRoute53RecordSetGroupWithName retrieves all AWSRoute53RecordSetGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSRoute53RecordSetGroupWithName(name string) (AWSRoute53RecordSetGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSRoute53RecordSetGroup: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Route53::RecordSetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSRoute53RecordSetGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSRoute53RecordSetGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_aliastarget.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_aliastarget.go new file mode 100644 index 0000000000..d052b414cf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_aliastarget.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSRoute53RecordSetGroup_AliasTarget AWS CloudFormation Resource (AWS::Route53::RecordSetGroup.AliasTarget) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html +type AWSRoute53RecordSetGroup_AliasTarget struct { + + // DNSName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-dnshostname + DNSName string `json:"DNSName,omitempty"` + + // EvaluateTargetHealth AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-evaluatetargethealth + EvaluateTargetHealth bool `json:"EvaluateTargetHealth,omitempty"` + + // HostedZoneId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-hostedzoneid + HostedZoneId string `json:"HostedZoneId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSetGroup_AliasTarget) AWSCloudFormationType() string { + return "AWS::Route53::RecordSetGroup.AliasTarget" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53RecordSetGroup_AliasTarget) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_geolocation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_geolocation.go new file mode 100644 index 0000000000..aab34806e8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_geolocation.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSRoute53RecordSetGroup_GeoLocation AWS CloudFormation Resource (AWS::Route53::RecordSetGroup.GeoLocation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-geolocation.html +type AWSRoute53RecordSetGroup_GeoLocation struct { + + // ContinentCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-geolocation.html#cfn-route53-recordsetgroup-geolocation-continentcode + ContinentCode string `json:"ContinentCode,omitempty"` + + // CountryCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-geolocation.html#cfn-route53-recordset-geolocation-countrycode + CountryCode string `json:"CountryCode,omitempty"` + + // SubdivisionCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-geolocation.html#cfn-route53-recordset-geolocation-subdivisioncode + SubdivisionCode string `json:"SubdivisionCode,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSetGroup_GeoLocation) AWSCloudFormationType() string { + return "AWS::Route53::RecordSetGroup.GeoLocation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53RecordSetGroup_GeoLocation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_recordset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_recordset.go new file mode 100644 index 0000000000..8e1d9f2bc2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_recordset.go @@ -0,0 +1,86 @@ +package cloudformation + +// AWSRoute53RecordSetGroup_RecordSet AWS CloudFormation Resource (AWS::Route53::RecordSetGroup.RecordSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html +type AWSRoute53RecordSetGroup_RecordSet struct { + + // AliasTarget AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-aliastarget + AliasTarget *AWSRoute53RecordSetGroup_AliasTarget `json:"AliasTarget,omitempty"` + + // Comment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-comment + Comment string `json:"Comment,omitempty"` + + // Failover AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-failover + Failover string `json:"Failover,omitempty"` + + // GeoLocation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-geolocation + GeoLocation *AWSRoute53RecordSetGroup_GeoLocation `json:"GeoLocation,omitempty"` + + // HealthCheckId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-healthcheckid + HealthCheckId string `json:"HealthCheckId,omitempty"` + + // HostedZoneId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-hostedzoneid + HostedZoneId string `json:"HostedZoneId,omitempty"` + + // HostedZoneName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-hostedzonename + HostedZoneName string `json:"HostedZoneName,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-name + Name string `json:"Name,omitempty"` + + // Region AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-region + Region string `json:"Region,omitempty"` + + // ResourceRecords AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-resourcerecords + ResourceRecords []string `json:"ResourceRecords,omitempty"` + + // SetIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-setidentifier + SetIdentifier string `json:"SetIdentifier,omitempty"` + + // TTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-ttl + TTL string `json:"TTL,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-type + Type string `json:"Type,omitempty"` + + // Weight AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-weight + Weight int `json:"Weight,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSetGroup_RecordSet) AWSCloudFormationType() string { + return "AWS::Route53::RecordSetGroup.RecordSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSRoute53RecordSetGroup_RecordSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket.go new file mode 100644 index 0000000000..f8d27df351 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket.go @@ -0,0 +1,160 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSS3Bucket AWS CloudFormation Resource (AWS::S3::Bucket) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html +type AWSS3Bucket struct { + + // AccessControl AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-accesscontrol + AccessControl string `json:"AccessControl,omitempty"` + + // BucketName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-name + BucketName string `json:"BucketName,omitempty"` + + // CorsConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-crossoriginconfig + CorsConfiguration *AWSS3Bucket_CorsConfiguration `json:"CorsConfiguration,omitempty"` + + // LifecycleConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-lifecycleconfig + LifecycleConfiguration *AWSS3Bucket_LifecycleConfiguration `json:"LifecycleConfiguration,omitempty"` + + // LoggingConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-loggingconfig + LoggingConfiguration *AWSS3Bucket_LoggingConfiguration `json:"LoggingConfiguration,omitempty"` + + // NotificationConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-notification + NotificationConfiguration *AWSS3Bucket_NotificationConfiguration `json:"NotificationConfiguration,omitempty"` + + // ReplicationConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-replicationconfiguration + ReplicationConfiguration *AWSS3Bucket_ReplicationConfiguration `json:"ReplicationConfiguration,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-tags + Tags []Tag `json:"Tags,omitempty"` + + // VersioningConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-versioning + VersioningConfiguration *AWSS3Bucket_VersioningConfiguration `json:"VersioningConfiguration,omitempty"` + + // WebsiteConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-websiteconfiguration + WebsiteConfiguration *AWSS3Bucket_WebsiteConfiguration `json:"WebsiteConfiguration,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket) AWSCloudFormationType() string { + return "AWS::S3::Bucket" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSS3Bucket) MarshalJSON() ([]byte, error) { + type Properties AWSS3Bucket + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSS3Bucket) UnmarshalJSON(b []byte) error { + type Properties AWSS3Bucket + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSS3Bucket(*res.Properties) + } + + return nil +} + +// GetAllAWSS3BucketResources retrieves all AWSS3Bucket items from an AWS CloudFormation template +func (t *Template) GetAllAWSS3BucketResources() map[string]AWSS3Bucket { + results := map[string]AWSS3Bucket{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSS3Bucket: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::S3::Bucket" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSS3Bucket + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSS3BucketWithName retrieves all AWSS3Bucket items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSS3BucketWithName(name string) (AWSS3Bucket, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSS3Bucket: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::S3::Bucket" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSS3Bucket + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSS3Bucket{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_corsconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_corsconfiguration.go new file mode 100644 index 0000000000..d566243bec --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_corsconfiguration.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSS3Bucket_CorsConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.CorsConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors.html +type AWSS3Bucket_CorsConfiguration struct { + + // CorsRules AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors.html#cfn-s3-bucket-cors-corsrule + CorsRules []AWSS3Bucket_CorsRule `json:"CorsRules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_CorsConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.CorsConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_CorsConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_corsrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_corsrule.go new file mode 100644 index 0000000000..88a78fb1a2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_corsrule.go @@ -0,0 +1,46 @@ +package cloudformation + +// AWSS3Bucket_CorsRule AWS CloudFormation Resource (AWS::S3::Bucket.CorsRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors-corsrule.html +type AWSS3Bucket_CorsRule struct { + + // AllowedHeaders AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors-corsrule.html#cfn-s3-bucket-cors-corsrule-allowedheaders + AllowedHeaders []string `json:"AllowedHeaders,omitempty"` + + // AllowedMethods AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors-corsrule.html#cfn-s3-bucket-cors-corsrule-allowedmethods + AllowedMethods []string `json:"AllowedMethods,omitempty"` + + // AllowedOrigins AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors-corsrule.html#cfn-s3-bucket-cors-corsrule-allowedorigins + AllowedOrigins []string `json:"AllowedOrigins,omitempty"` + + // ExposedHeaders AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors-corsrule.html#cfn-s3-bucket-cors-corsrule-exposedheaders + ExposedHeaders []string `json:"ExposedHeaders,omitempty"` + + // Id AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors-corsrule.html#cfn-s3-bucket-cors-corsrule-id + Id string `json:"Id,omitempty"` + + // MaxAge AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors-corsrule.html#cfn-s3-bucket-cors-corsrule-maxage + MaxAge int `json:"MaxAge,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_CorsRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.CorsRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_CorsRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_filterrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_filterrule.go new file mode 100644 index 0000000000..942d46bca1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_filterrule.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSS3Bucket_FilterRule AWS CloudFormation Resource (AWS::S3::Bucket.FilterRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter-s3key-rules.html +type AWSS3Bucket_FilterRule struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter-s3key-rules.html#cfn-s3-bucket-notificationconfiguraiton-config-filter-s3key-rules-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter-s3key-rules.html#cfn-s3-bucket-notificationconfiguraiton-config-filter-s3key-rules-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_FilterRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.FilterRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_FilterRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_lambdaconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_lambdaconfiguration.go new file mode 100644 index 0000000000..2f7ff0b207 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_lambdaconfiguration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSS3Bucket_LambdaConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.LambdaConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-lambdaconfig.html +type AWSS3Bucket_LambdaConfiguration struct { + + // Event AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-lambdaconfig.html#cfn-s3-bucket-notificationconfig-lambdaconfig-event + Event string `json:"Event,omitempty"` + + // Filter AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-lambdaconfig.html#cfn-s3-bucket-notificationconfig-lambdaconfig-filter + Filter *AWSS3Bucket_NotificationFilter `json:"Filter,omitempty"` + + // Function AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-lambdaconfig.html#cfn-s3-bucket-notificationconfig-lambdaconfig-function + Function string `json:"Function,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_LambdaConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.LambdaConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_LambdaConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_lifecycleconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_lifecycleconfiguration.go new file mode 100644 index 0000000000..09ea459965 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_lifecycleconfiguration.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSS3Bucket_LifecycleConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.LifecycleConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig.html +type AWSS3Bucket_LifecycleConfiguration struct { + + // Rules AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig.html#cfn-s3-bucket-lifecycleconfig-rules + Rules []AWSS3Bucket_Rule `json:"Rules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_LifecycleConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.LifecycleConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_LifecycleConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_loggingconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_loggingconfiguration.go new file mode 100644 index 0000000000..81321aeebb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_loggingconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSS3Bucket_LoggingConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.LoggingConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-loggingconfig.html +type AWSS3Bucket_LoggingConfiguration struct { + + // DestinationBucketName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-loggingconfig.html#cfn-s3-bucket-loggingconfig-destinationbucketname + DestinationBucketName string `json:"DestinationBucketName,omitempty"` + + // LogFilePrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-loggingconfig.html#cfn-s3-bucket-loggingconfig-logfileprefix + LogFilePrefix string `json:"LogFilePrefix,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_LoggingConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.LoggingConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_LoggingConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_noncurrentversiontransition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_noncurrentversiontransition.go new file mode 100644 index 0000000000..1bd92d26ff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_noncurrentversiontransition.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSS3Bucket_NoncurrentVersionTransition AWS CloudFormation Resource (AWS::S3::Bucket.NoncurrentVersionTransition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule-noncurrentversiontransition.html +type AWSS3Bucket_NoncurrentVersionTransition struct { + + // StorageClass AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule-noncurrentversiontransition.html#cfn-s3-bucket-lifecycleconfig-rule-noncurrentversiontransition-storageclass + StorageClass string `json:"StorageClass,omitempty"` + + // TransitionInDays AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule-noncurrentversiontransition.html#cfn-s3-bucket-lifecycleconfig-rule-noncurrentversiontransition-transitionindays + TransitionInDays int `json:"TransitionInDays,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_NoncurrentVersionTransition) AWSCloudFormationType() string { + return "AWS::S3::Bucket.NoncurrentVersionTransition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_NoncurrentVersionTransition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_notificationconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_notificationconfiguration.go new file mode 100644 index 0000000000..c99b8ccddd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_notificationconfiguration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSS3Bucket_NotificationConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.NotificationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig.html +type AWSS3Bucket_NotificationConfiguration struct { + + // LambdaConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig.html#cfn-s3-bucket-notificationconfig-lambdaconfig + LambdaConfigurations []AWSS3Bucket_LambdaConfiguration `json:"LambdaConfigurations,omitempty"` + + // QueueConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig.html#cfn-s3-bucket-notificationconfig-queueconfig + QueueConfigurations []AWSS3Bucket_QueueConfiguration `json:"QueueConfigurations,omitempty"` + + // TopicConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig.html#cfn-s3-bucket-notificationconfig-topicconfig + TopicConfigurations []AWSS3Bucket_TopicConfiguration `json:"TopicConfigurations,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_NotificationConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.NotificationConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_NotificationConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_notificationfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_notificationfilter.go new file mode 100644 index 0000000000..a085624f17 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_notificationfilter.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSS3Bucket_NotificationFilter AWS CloudFormation Resource (AWS::S3::Bucket.NotificationFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter.html +type AWSS3Bucket_NotificationFilter struct { + + // S3Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter.html#cfn-s3-bucket-notificationconfiguraiton-config-filter-s3key + S3Key *AWSS3Bucket_S3KeyFilter `json:"S3Key,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_NotificationFilter) AWSCloudFormationType() string { + return "AWS::S3::Bucket.NotificationFilter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_NotificationFilter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_queueconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_queueconfiguration.go new file mode 100644 index 0000000000..baefa97800 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_queueconfiguration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSS3Bucket_QueueConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.QueueConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-queueconfig.html +type AWSS3Bucket_QueueConfiguration struct { + + // Event AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-queueconfig.html#cfn-s3-bucket-notificationconfig-queueconfig-event + Event string `json:"Event,omitempty"` + + // Filter AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-queueconfig.html#cfn-s3-bucket-notificationconfig-queueconfig-filter + Filter *AWSS3Bucket_NotificationFilter `json:"Filter,omitempty"` + + // Queue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-queueconfig.html#cfn-s3-bucket-notificationconfig-queueconfig-queue + Queue string `json:"Queue,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_QueueConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.QueueConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_QueueConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_redirectallrequeststo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_redirectallrequeststo.go new file mode 100644 index 0000000000..c4bd626a40 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_redirectallrequeststo.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSS3Bucket_RedirectAllRequestsTo AWS CloudFormation Resource (AWS::S3::Bucket.RedirectAllRequestsTo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-redirectallrequeststo.html +type AWSS3Bucket_RedirectAllRequestsTo struct { + + // HostName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-redirectallrequeststo.html#cfn-s3-websiteconfiguration-redirectallrequeststo-hostname + HostName string `json:"HostName,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-redirectallrequeststo.html#cfn-s3-websiteconfiguration-redirectallrequeststo-protocol + Protocol string `json:"Protocol,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_RedirectAllRequestsTo) AWSCloudFormationType() string { + return "AWS::S3::Bucket.RedirectAllRequestsTo" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_RedirectAllRequestsTo) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_redirectrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_redirectrule.go new file mode 100644 index 0000000000..41e148b358 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_redirectrule.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSS3Bucket_RedirectRule AWS CloudFormation Resource (AWS::S3::Bucket.RedirectRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-redirectrule.html +type AWSS3Bucket_RedirectRule struct { + + // HostName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-redirectrule.html#cfn-s3-websiteconfiguration-redirectrule-hostname + HostName string `json:"HostName,omitempty"` + + // HttpRedirectCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-redirectrule.html#cfn-s3-websiteconfiguration-redirectrule-httpredirectcode + HttpRedirectCode string `json:"HttpRedirectCode,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-redirectrule.html#cfn-s3-websiteconfiguration-redirectrule-protocol + Protocol string `json:"Protocol,omitempty"` + + // ReplaceKeyPrefixWith AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-redirectrule.html#cfn-s3-websiteconfiguration-redirectrule-replacekeyprefixwith + ReplaceKeyPrefixWith string `json:"ReplaceKeyPrefixWith,omitempty"` + + // ReplaceKeyWith AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-redirectrule.html#cfn-s3-websiteconfiguration-redirectrule-replacekeywith + ReplaceKeyWith string `json:"ReplaceKeyWith,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_RedirectRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.RedirectRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_RedirectRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationconfiguration.go new file mode 100644 index 0000000000..0adb428726 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationconfiguration.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSS3Bucket_ReplicationConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.ReplicationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration.html +type AWSS3Bucket_ReplicationConfiguration struct { + + // Role AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration.html#cfn-s3-bucket-replicationconfiguration-role + Role string `json:"Role,omitempty"` + + // Rules AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration.html#cfn-s3-bucket-replicationconfiguration-rules + Rules []AWSS3Bucket_ReplicationRule `json:"Rules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_ReplicationConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.ReplicationConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_ReplicationConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationdestination.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationdestination.go new file mode 100644 index 0000000000..9070bcf813 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationdestination.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSS3Bucket_ReplicationDestination AWS CloudFormation Resource (AWS::S3::Bucket.ReplicationDestination) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules-destination.html +type AWSS3Bucket_ReplicationDestination struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules-destination.html#cfn-s3-bucket-replicationconfiguration-rules-destination-bucket + Bucket string `json:"Bucket,omitempty"` + + // StorageClass AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules-destination.html#cfn-s3-bucket-replicationconfiguration-rules-destination-storageclass + StorageClass string `json:"StorageClass,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_ReplicationDestination) AWSCloudFormationType() string { + return "AWS::S3::Bucket.ReplicationDestination" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_ReplicationDestination) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationrule.go new file mode 100644 index 0000000000..befe88ca27 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationrule.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSS3Bucket_ReplicationRule AWS CloudFormation Resource (AWS::S3::Bucket.ReplicationRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules.html +type AWSS3Bucket_ReplicationRule struct { + + // Destination AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules.html#cfn-s3-bucket-replicationconfiguration-rules-destination + Destination *AWSS3Bucket_ReplicationDestination `json:"Destination,omitempty"` + + // Id AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules.html#cfn-s3-bucket-replicationconfiguration-rules-id + Id string `json:"Id,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules.html#cfn-s3-bucket-replicationconfiguration-rules-prefix + Prefix string `json:"Prefix,omitempty"` + + // Status AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules.html#cfn-s3-bucket-replicationconfiguration-rules-status + Status string `json:"Status,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_ReplicationRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.ReplicationRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_ReplicationRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_routingrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_routingrule.go new file mode 100644 index 0000000000..3a6f729c6d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_routingrule.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSS3Bucket_RoutingRule AWS CloudFormation Resource (AWS::S3::Bucket.RoutingRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules.html +type AWSS3Bucket_RoutingRule struct { + + // RedirectRule AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules.html#cfn-s3-websiteconfiguration-routingrules-redirectrule + RedirectRule *AWSS3Bucket_RedirectRule `json:"RedirectRule,omitempty"` + + // RoutingRuleCondition AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules.html#cfn-s3-websiteconfiguration-routingrules-routingrulecondition + RoutingRuleCondition *AWSS3Bucket_RoutingRuleCondition `json:"RoutingRuleCondition,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_RoutingRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.RoutingRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_RoutingRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_routingrulecondition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_routingrulecondition.go new file mode 100644 index 0000000000..e615d5f2a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_routingrulecondition.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSS3Bucket_RoutingRuleCondition AWS CloudFormation Resource (AWS::S3::Bucket.RoutingRuleCondition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-routingrulecondition.html +type AWSS3Bucket_RoutingRuleCondition struct { + + // HttpErrorCodeReturnedEquals AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-routingrulecondition.html#cfn-s3-websiteconfiguration-routingrules-routingrulecondition-httperrorcodereturnedequals + HttpErrorCodeReturnedEquals string `json:"HttpErrorCodeReturnedEquals,omitempty"` + + // KeyPrefixEquals AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules-routingrulecondition.html#cfn-s3-websiteconfiguration-routingrules-routingrulecondition-keyprefixequals + KeyPrefixEquals string `json:"KeyPrefixEquals,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_RoutingRuleCondition) AWSCloudFormationType() string { + return "AWS::S3::Bucket.RoutingRuleCondition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_RoutingRuleCondition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_rule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_rule.go new file mode 100644 index 0000000000..edb893f44a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_rule.go @@ -0,0 +1,66 @@ +package cloudformation + +// AWSS3Bucket_Rule AWS CloudFormation Resource (AWS::S3::Bucket.Rule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html +type AWSS3Bucket_Rule struct { + + // ExpirationDate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-expirationdate + ExpirationDate string `json:"ExpirationDate,omitempty"` + + // ExpirationInDays AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-expirationindays + ExpirationInDays int `json:"ExpirationInDays,omitempty"` + + // Id AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-id + Id string `json:"Id,omitempty"` + + // NoncurrentVersionExpirationInDays AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-noncurrentversionexpirationindays + NoncurrentVersionExpirationInDays int `json:"NoncurrentVersionExpirationInDays,omitempty"` + + // NoncurrentVersionTransition AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-noncurrentversiontransition + NoncurrentVersionTransition *AWSS3Bucket_NoncurrentVersionTransition `json:"NoncurrentVersionTransition,omitempty"` + + // NoncurrentVersionTransitions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-noncurrentversiontransitions + NoncurrentVersionTransitions *AWSS3Bucket_NoncurrentVersionTransition `json:"NoncurrentVersionTransitions,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-prefix + Prefix string `json:"Prefix,omitempty"` + + // Status AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-status + Status string `json:"Status,omitempty"` + + // Transition AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-transition + Transition *AWSS3Bucket_Transition `json:"Transition,omitempty"` + + // Transitions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-lifecycleconfig-rule-transitions + Transitions *AWSS3Bucket_Transition `json:"Transitions,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_Rule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.Rule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_Rule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_s3keyfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_s3keyfilter.go new file mode 100644 index 0000000000..399cb9426d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_s3keyfilter.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSS3Bucket_S3KeyFilter AWS CloudFormation Resource (AWS::S3::Bucket.S3KeyFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter-s3key.html +type AWSS3Bucket_S3KeyFilter struct { + + // Rules AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter-s3key.html#cfn-s3-bucket-notificationconfiguraiton-config-filter-s3key-rules + Rules []AWSS3Bucket_FilterRule `json:"Rules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_S3KeyFilter) AWSCloudFormationType() string { + return "AWS::S3::Bucket.S3KeyFilter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_S3KeyFilter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_topicconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_topicconfiguration.go new file mode 100644 index 0000000000..a199853b51 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_topicconfiguration.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSS3Bucket_TopicConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.TopicConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-topicconfig.html +type AWSS3Bucket_TopicConfiguration struct { + + // Event AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-topicconfig.html#cfn-s3-bucket-notificationconfig-topicconfig-event + Event string `json:"Event,omitempty"` + + // Filter AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-topicconfig.html#cfn-s3-bucket-notificationconfig-topicconfig-filter + Filter *AWSS3Bucket_NotificationFilter `json:"Filter,omitempty"` + + // Topic AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-topicconfig.html#cfn-s3-bucket-notificationconfig-topicconfig-topic + Topic string `json:"Topic,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_TopicConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.TopicConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_TopicConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_transition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_transition.go new file mode 100644 index 0000000000..ccd0d447ed --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_transition.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSS3Bucket_Transition AWS CloudFormation Resource (AWS::S3::Bucket.Transition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule-transition.html +type AWSS3Bucket_Transition struct { + + // StorageClass AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule-transition.html#cfn-s3-bucket-lifecycleconfig-rule-transition-storageclass + StorageClass string `json:"StorageClass,omitempty"` + + // TransitionDate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule-transition.html#cfn-s3-bucket-lifecycleconfig-rule-transition-transitiondate + TransitionDate string `json:"TransitionDate,omitempty"` + + // TransitionInDays AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule-transition.html#cfn-s3-bucket-lifecycleconfig-rule-transition-transitionindays + TransitionInDays int `json:"TransitionInDays,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_Transition) AWSCloudFormationType() string { + return "AWS::S3::Bucket.Transition" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_Transition) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_versioningconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_versioningconfiguration.go new file mode 100644 index 0000000000..74490d9e1b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_versioningconfiguration.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSS3Bucket_VersioningConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.VersioningConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-versioningconfig.html +type AWSS3Bucket_VersioningConfiguration struct { + + // Status AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-versioningconfig.html#cfn-s3-bucket-versioningconfig-status + Status string `json:"Status,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_VersioningConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.VersioningConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_VersioningConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_websiteconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_websiteconfiguration.go new file mode 100644 index 0000000000..8869b30bc0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_websiteconfiguration.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSS3Bucket_WebsiteConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.WebsiteConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration.html +type AWSS3Bucket_WebsiteConfiguration struct { + + // ErrorDocument AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration.html#cfn-s3-websiteconfiguration-errordocument + ErrorDocument string `json:"ErrorDocument,omitempty"` + + // IndexDocument AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration.html#cfn-s3-websiteconfiguration-indexdocument + IndexDocument string `json:"IndexDocument,omitempty"` + + // RedirectAllRequestsTo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration.html#cfn-s3-websiteconfiguration-redirectallrequeststo + RedirectAllRequestsTo *AWSS3Bucket_RedirectAllRequestsTo `json:"RedirectAllRequestsTo,omitempty"` + + // RoutingRules AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration.html#cfn-s3-websiteconfiguration-routingrules + RoutingRules []AWSS3Bucket_RoutingRule `json:"RoutingRules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_WebsiteConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.WebsiteConfiguration" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3Bucket_WebsiteConfiguration) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucketpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucketpolicy.go new file mode 100644 index 0000000000..ec5ac7f779 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucketpolicy.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSS3BucketPolicy AWS CloudFormation Resource (AWS::S3::BucketPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-policy.html +type AWSS3BucketPolicy struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-policy.html#cfn-s3-bucketpolicy-bucket + Bucket string `json:"Bucket,omitempty"` + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-policy.html#cfn-s3-bucketpolicy-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3BucketPolicy) AWSCloudFormationType() string { + return "AWS::S3::BucketPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSS3BucketPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSS3BucketPolicy) MarshalJSON() ([]byte, error) { + type Properties AWSS3BucketPolicy + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSS3BucketPolicy) UnmarshalJSON(b []byte) error { + type Properties AWSS3BucketPolicy + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSS3BucketPolicy(*res.Properties) + } + + return nil +} + +// GetAllAWSS3BucketPolicyResources retrieves all AWSS3BucketPolicy items from an AWS CloudFormation template +func (t *Template) GetAllAWSS3BucketPolicyResources() map[string]AWSS3BucketPolicy { + results := map[string]AWSS3BucketPolicy{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSS3BucketPolicy: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::S3::BucketPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSS3BucketPolicy + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSS3BucketPolicyWithName retrieves all AWSS3BucketPolicy items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSS3BucketPolicyWithName(name string) (AWSS3BucketPolicy, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSS3BucketPolicy: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::S3::BucketPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSS3BucketPolicy + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSS3BucketPolicy{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sdb-domain.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sdb-domain.go new file mode 100644 index 0000000000..fbff777bc3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sdb-domain.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSDBDomain AWS CloudFormation Resource (AWS::SDB::Domain) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-simpledb.html +type AWSSDBDomain struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-simpledb.html#cfn-sdb-domain-description + Description string `json:"Description,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSDBDomain) AWSCloudFormationType() string { + return "AWS::SDB::Domain" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSDBDomain) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSDBDomain) MarshalJSON() ([]byte, error) { + type Properties AWSSDBDomain + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSDBDomain) UnmarshalJSON(b []byte) error { + type Properties AWSSDBDomain + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSDBDomain(*res.Properties) + } + + return nil +} + +// GetAllAWSSDBDomainResources retrieves all AWSSDBDomain items from an AWS CloudFormation template +func (t *Template) GetAllAWSSDBDomainResources() map[string]AWSSDBDomain { + results := map[string]AWSSDBDomain{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSDBDomain: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SDB::Domain" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSDBDomain + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSDBDomainWithName retrieves all AWSSDBDomain items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSDBDomainWithName(name string) (AWSSDBDomain, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSDBDomain: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SDB::Domain" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSDBDomain + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSDBDomain{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-api.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-api.go new file mode 100644 index 0000000000..e67fd7f1bd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-api.go @@ -0,0 +1,145 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServerlessApi AWS CloudFormation Resource (AWS::Serverless::Api) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi +type AWSServerlessApi struct { + + // CacheClusterEnabled AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi + CacheClusterEnabled bool `json:"CacheClusterEnabled,omitempty"` + + // CacheClusterSize AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi + CacheClusterSize string `json:"CacheClusterSize,omitempty"` + + // DefinitionBody AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi + DefinitionBody interface{} `json:"DefinitionBody,omitempty"` + + // DefinitionUri AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi + DefinitionUri *AWSServerlessApi_StringOrS3Location `json:"DefinitionUri,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi + Name string `json:"Name,omitempty"` + + // StageName AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi + StageName string `json:"StageName,omitempty"` + + // Variables AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi + Variables map[string]string `json:"Variables,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessApi) AWSCloudFormationType() string { + return "AWS::Serverless::Api" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessApi) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSServerlessApi) MarshalJSON() ([]byte, error) { + type Properties AWSServerlessApi + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServerlessApi) UnmarshalJSON(b []byte) error { + type Properties AWSServerlessApi + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSServerlessApi(*res.Properties) + } + + return nil +} + +// GetAllAWSServerlessApiResources retrieves all AWSServerlessApi items from an AWS CloudFormation template +func (t *Template) GetAllAWSServerlessApiResources() map[string]AWSServerlessApi { + results := map[string]AWSServerlessApi{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServerlessApi: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Serverless::Api" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServerlessApi + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServerlessApiWithName retrieves all AWSServerlessApi items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServerlessApiWithName(name string) (AWSServerlessApi, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServerlessApi: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Serverless::Api" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServerlessApi + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServerlessApi{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-api_s3location.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-api_s3location.go new file mode 100644 index 0000000000..0915b686b4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-api_s3location.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSServerlessApi_S3Location AWS CloudFormation Resource (AWS::Serverless::Api.S3Location) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#s3-location-object +type AWSServerlessApi_S3Location struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Bucket string `json:"Bucket,omitempty"` + + // Key AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Key string `json:"Key,omitempty"` + + // Version AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Version int `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessApi_S3Location) AWSCloudFormationType() string { + return "AWS::Serverless::Api.S3Location" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessApi_S3Location) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function.go new file mode 100644 index 0000000000..b28866bde4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function.go @@ -0,0 +1,190 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServerlessFunction AWS CloudFormation Resource (AWS::Serverless::Function) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction +type AWSServerlessFunction struct { + + // CodeUri AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + CodeUri *AWSServerlessFunction_StringOrS3Location `json:"CodeUri,omitempty"` + + // DeadLetterQueue AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + DeadLetterQueue *AWSServerlessFunction_DeadLetterQueue `json:"DeadLetterQueue,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Description string `json:"Description,omitempty"` + + // Environment AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Environment *AWSServerlessFunction_FunctionEnvironment `json:"Environment,omitempty"` + + // Events AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Events map[string]AWSServerlessFunction_EventSource `json:"Events,omitempty"` + + // FunctionName AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + FunctionName string `json:"FunctionName,omitempty"` + + // Handler AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Handler string `json:"Handler,omitempty"` + + // KmsKeyArn AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + KmsKeyArn string `json:"KmsKeyArn,omitempty"` + + // MemorySize AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + MemorySize int `json:"MemorySize,omitempty"` + + // Policies AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Policies *AWSServerlessFunction_StringOrIAMPolicyDocumentOrListOfStringOrListOfIAMPolicyDocument `json:"Policies,omitempty"` + + // Role AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Role string `json:"Role,omitempty"` + + // Runtime AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Runtime string `json:"Runtime,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Tags map[string]string `json:"Tags,omitempty"` + + // Timeout AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Timeout int `json:"Timeout,omitempty"` + + // Tracing AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Tracing string `json:"Tracing,omitempty"` + + // VpcConfig AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + VpcConfig *AWSServerlessFunction_VpcConfig `json:"VpcConfig,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction) AWSCloudFormationType() string { + return "AWS::Serverless::Function" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSServerlessFunction) MarshalJSON() ([]byte, error) { + type Properties AWSServerlessFunction + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServerlessFunction) UnmarshalJSON(b []byte) error { + type Properties AWSServerlessFunction + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSServerlessFunction(*res.Properties) + } + + return nil +} + +// GetAllAWSServerlessFunctionResources retrieves all AWSServerlessFunction items from an AWS CloudFormation template +func (t *Template) GetAllAWSServerlessFunctionResources() map[string]AWSServerlessFunction { + results := map[string]AWSServerlessFunction{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServerlessFunction: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Serverless::Function" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServerlessFunction + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServerlessFunctionWithName retrieves all AWSServerlessFunction items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServerlessFunctionWithName(name string) (AWSServerlessFunction, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServerlessFunction: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Serverless::Function" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServerlessFunction + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServerlessFunction{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_alexaskillevent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_alexaskillevent.go new file mode 100644 index 0000000000..1cebd93604 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_alexaskillevent.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSServerlessFunction_AlexaSkillEvent AWS CloudFormation Resource (AWS::Serverless::Function.AlexaSkillEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#alexaskill +type AWSServerlessFunction_AlexaSkillEvent struct { + + // Variables AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#alexaskill + Variables map[string]string `json:"Variables,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_AlexaSkillEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.AlexaSkillEvent" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_AlexaSkillEvent) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_apievent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_apievent.go new file mode 100644 index 0000000000..2c4fdf9030 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_apievent.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSServerlessFunction_ApiEvent AWS CloudFormation Resource (AWS::Serverless::Function.ApiEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api +type AWSServerlessFunction_ApiEvent struct { + + // Method AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api + Method string `json:"Method,omitempty"` + + // Path AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api + Path string `json:"Path,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api + RestApiId string `json:"RestApiId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_ApiEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.ApiEvent" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_ApiEvent) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_cloudwatcheventevent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_cloudwatcheventevent.go new file mode 100644 index 0000000000..c6c1f3b2fc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_cloudwatcheventevent.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSServerlessFunction_CloudWatchEventEvent AWS CloudFormation Resource (AWS::Serverless::Function.CloudWatchEventEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchevent +type AWSServerlessFunction_CloudWatchEventEvent struct { + + // Input AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchevent + Input string `json:"Input,omitempty"` + + // InputPath AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#cloudwatchevent + InputPath string `json:"InputPath,omitempty"` + + // Pattern AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html + Pattern interface{} `json:"Pattern,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_CloudWatchEventEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.CloudWatchEventEvent" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_CloudWatchEventEvent) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_deadletterqueue.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_deadletterqueue.go new file mode 100644 index 0000000000..fddf9a732d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_deadletterqueue.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSServerlessFunction_DeadLetterQueue AWS CloudFormation Resource (AWS::Serverless::Function.DeadLetterQueue) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#deadletterqueue-object +type AWSServerlessFunction_DeadLetterQueue struct { + + // TargetArn AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + TargetArn string `json:"TargetArn,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_DeadLetterQueue) AWSCloudFormationType() string { + return "AWS::Serverless::Function.DeadLetterQueue" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_DeadLetterQueue) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_dynamodbevent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_dynamodbevent.go new file mode 100644 index 0000000000..647588e486 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_dynamodbevent.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSServerlessFunction_DynamoDBEvent AWS CloudFormation Resource (AWS::Serverless::Function.DynamoDBEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb +type AWSServerlessFunction_DynamoDBEvent struct { + + // BatchSize AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb + BatchSize int `json:"BatchSize,omitempty"` + + // StartingPosition AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb + StartingPosition string `json:"StartingPosition,omitempty"` + + // Stream AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#dynamodb + Stream string `json:"Stream,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_DynamoDBEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.DynamoDBEvent" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_DynamoDBEvent) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_eventsource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_eventsource.go new file mode 100644 index 0000000000..952fbfbabf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_eventsource.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSServerlessFunction_EventSource AWS CloudFormation Resource (AWS::Serverless::Function.EventSource) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#event-source-object +type AWSServerlessFunction_EventSource struct { + + // Properties AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#event-source-types + Properties *AWSServerlessFunction_S3EventOrSNSEventOrKinesisEventOrDynamoDBEventOrApiEventOrScheduleEventOrCloudWatchEventEventOrIoTRuleEventOrAlexaSkillEvent `json:"Properties,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#event-source-object + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_EventSource) AWSCloudFormationType() string { + return "AWS::Serverless::Function.EventSource" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_EventSource) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_functionenvironment.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_functionenvironment.go new file mode 100644 index 0000000000..5dff27b689 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_functionenvironment.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSServerlessFunction_FunctionEnvironment AWS CloudFormation Resource (AWS::Serverless::Function.FunctionEnvironment) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object +type AWSServerlessFunction_FunctionEnvironment struct { + + // Variables AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object + Variables map[string]string `json:"Variables,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_FunctionEnvironment) AWSCloudFormationType() string { + return "AWS::Serverless::Function.FunctionEnvironment" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_FunctionEnvironment) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_iampolicydocument.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_iampolicydocument.go new file mode 100644 index 0000000000..579ab4a522 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_iampolicydocument.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSServerlessFunction_IAMPolicyDocument AWS CloudFormation Resource (AWS::Serverless::Function.IAMPolicyDocument) +// See: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html +type AWSServerlessFunction_IAMPolicyDocument struct { + + // Statement AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html + Statement interface{} `json:"Statement,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_IAMPolicyDocument) AWSCloudFormationType() string { + return "AWS::Serverless::Function.IAMPolicyDocument" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_IAMPolicyDocument) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_iotruleevent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_iotruleevent.go new file mode 100644 index 0000000000..09be7da9de --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_iotruleevent.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSServerlessFunction_IoTRuleEvent AWS CloudFormation Resource (AWS::Serverless::Function.IoTRuleEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#iotrule +type AWSServerlessFunction_IoTRuleEvent struct { + + // AwsIotSqlVersion AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#iotrule + AwsIotSqlVersion string `json:"AwsIotSqlVersion,omitempty"` + + // Sql AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#iotrule + Sql string `json:"Sql,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_IoTRuleEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.IoTRuleEvent" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_IoTRuleEvent) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_kinesisevent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_kinesisevent.go new file mode 100644 index 0000000000..4fce785d55 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_kinesisevent.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSServerlessFunction_KinesisEvent AWS CloudFormation Resource (AWS::Serverless::Function.KinesisEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#kinesis +type AWSServerlessFunction_KinesisEvent struct { + + // BatchSize AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#kinesis + BatchSize int `json:"BatchSize,omitempty"` + + // StartingPosition AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#kinesis + StartingPosition string `json:"StartingPosition,omitempty"` + + // Stream AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#kinesis + Stream string `json:"Stream,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_KinesisEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.KinesisEvent" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_KinesisEvent) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3event.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3event.go new file mode 100644 index 0000000000..2150efed1f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3event.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSServerlessFunction_S3Event AWS CloudFormation Resource (AWS::Serverless::Function.S3Event) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#s3 +type AWSServerlessFunction_S3Event struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#s3 + Bucket string `json:"Bucket,omitempty"` + + // Events AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#s3 + Events *AWSServerlessFunction_StringOrListOfString `json:"Events,omitempty"` + + // Filter AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#s3 + Filter *AWSServerlessFunction_S3NotificationFilter `json:"Filter,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_S3Event) AWSCloudFormationType() string { + return "AWS::Serverless::Function.S3Event" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_S3Event) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3location.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3location.go new file mode 100644 index 0000000000..620a487ae8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3location.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSServerlessFunction_S3Location AWS CloudFormation Resource (AWS::Serverless::Function.S3Location) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#s3-location-object +type AWSServerlessFunction_S3Location struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Bucket string `json:"Bucket,omitempty"` + + // Key AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Key string `json:"Key,omitempty"` + + // Version AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Version int `json:"Version,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_S3Location) AWSCloudFormationType() string { + return "AWS::Serverless::Function.S3Location" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_S3Location) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3notificationfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3notificationfilter.go new file mode 100644 index 0000000000..aa9fc12cea --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3notificationfilter.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSServerlessFunction_S3NotificationFilter AWS CloudFormation Resource (AWS::Serverless::Function.S3NotificationFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter.html +type AWSServerlessFunction_S3NotificationFilter struct { + + // S3Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter.html + S3Key string `json:"S3Key,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_S3NotificationFilter) AWSCloudFormationType() string { + return "AWS::Serverless::Function.S3NotificationFilter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_S3NotificationFilter) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_scheduleevent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_scheduleevent.go new file mode 100644 index 0000000000..5bea895814 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_scheduleevent.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSServerlessFunction_ScheduleEvent AWS CloudFormation Resource (AWS::Serverless::Function.ScheduleEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule +type AWSServerlessFunction_ScheduleEvent struct { + + // Input AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule + Input string `json:"Input,omitempty"` + + // Schedule AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#schedule + Schedule string `json:"Schedule,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_ScheduleEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.ScheduleEvent" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_ScheduleEvent) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_snsevent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_snsevent.go new file mode 100644 index 0000000000..c2296daf8d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_snsevent.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSServerlessFunction_SNSEvent AWS CloudFormation Resource (AWS::Serverless::Function.SNSEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#sns +type AWSServerlessFunction_SNSEvent struct { + + // Topic AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#sns + Topic string `json:"Topic,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_SNSEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.SNSEvent" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_SNSEvent) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_vpcconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_vpcconfig.go new file mode 100644 index 0000000000..151f3ab961 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_vpcconfig.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSServerlessFunction_VpcConfig AWS CloudFormation Resource (AWS::Serverless::Function.VpcConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html +type AWSServerlessFunction_VpcConfig struct { + + // SecurityGroupIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html + SubnetIds []string `json:"SubnetIds,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_VpcConfig) AWSCloudFormationType() string { + return "AWS::Serverless::Function.VpcConfig" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessFunction_VpcConfig) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable.go new file mode 100644 index 0000000000..a2bc35728d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServerlessSimpleTable AWS CloudFormation Resource (AWS::Serverless::SimpleTable) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlesssimpletable +type AWSServerlessSimpleTable struct { + + // PrimaryKey AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#primary-key-object + PrimaryKey *AWSServerlessSimpleTable_PrimaryKey `json:"PrimaryKey,omitempty"` + + // ProvisionedThroughput AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html + ProvisionedThroughput *AWSServerlessSimpleTable_ProvisionedThroughput `json:"ProvisionedThroughput,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessSimpleTable) AWSCloudFormationType() string { + return "AWS::Serverless::SimpleTable" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessSimpleTable) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSServerlessSimpleTable) MarshalJSON() ([]byte, error) { + type Properties AWSServerlessSimpleTable + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServerlessSimpleTable) UnmarshalJSON(b []byte) error { + type Properties AWSServerlessSimpleTable + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSServerlessSimpleTable(*res.Properties) + } + + return nil +} + +// GetAllAWSServerlessSimpleTableResources retrieves all AWSServerlessSimpleTable items from an AWS CloudFormation template +func (t *Template) GetAllAWSServerlessSimpleTableResources() map[string]AWSServerlessSimpleTable { + results := map[string]AWSServerlessSimpleTable{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServerlessSimpleTable: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Serverless::SimpleTable" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServerlessSimpleTable + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServerlessSimpleTableWithName retrieves all AWSServerlessSimpleTable items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServerlessSimpleTableWithName(name string) (AWSServerlessSimpleTable, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServerlessSimpleTable: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::Serverless::SimpleTable" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServerlessSimpleTable + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServerlessSimpleTable{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable_primarykey.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable_primarykey.go new file mode 100644 index 0000000000..a9643f5df0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable_primarykey.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSServerlessSimpleTable_PrimaryKey AWS CloudFormation Resource (AWS::Serverless::SimpleTable.PrimaryKey) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#primary-key-object +type AWSServerlessSimpleTable_PrimaryKey struct { + + // Name AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#primary-key-object + Name string `json:"Name,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#primary-key-object + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessSimpleTable_PrimaryKey) AWSCloudFormationType() string { + return "AWS::Serverless::SimpleTable.PrimaryKey" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessSimpleTable_PrimaryKey) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable_provisionedthroughput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable_provisionedthroughput.go new file mode 100644 index 0000000000..58b994728f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable_provisionedthroughput.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSServerlessSimpleTable_ProvisionedThroughput AWS CloudFormation Resource (AWS::Serverless::SimpleTable.ProvisionedThroughput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html +type AWSServerlessSimpleTable_ProvisionedThroughput struct { + + // ReadCapacityUnits AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html + ReadCapacityUnits int `json:"ReadCapacityUnits,omitempty"` + + // WriteCapacityUnits AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html + WriteCapacityUnits int `json:"WriteCapacityUnits,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessSimpleTable_ProvisionedThroughput) AWSCloudFormationType() string { + return "AWS::Serverless::SimpleTable.ProvisionedThroughput" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSServerlessSimpleTable_ProvisionedThroughput) AWSCloudFormationSpecificationVersion() string { + return "2016-10-31" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-subscription.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-subscription.go new file mode 100644 index 0000000000..2c9bc64352 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-subscription.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSNSSubscription AWS CloudFormation Resource (AWS::SNS::Subscription) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html +type AWSSNSSubscription struct { + + // Endpoint AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-endpoint + Endpoint string `json:"Endpoint,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-protocol + Protocol string `json:"Protocol,omitempty"` + + // TopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#topicarn + TopicArn string `json:"TopicArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSNSSubscription) AWSCloudFormationType() string { + return "AWS::SNS::Subscription" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSNSSubscription) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSNSSubscription) MarshalJSON() ([]byte, error) { + type Properties AWSSNSSubscription + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSNSSubscription) UnmarshalJSON(b []byte) error { + type Properties AWSSNSSubscription + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSNSSubscription(*res.Properties) + } + + return nil +} + +// GetAllAWSSNSSubscriptionResources retrieves all AWSSNSSubscription items from an AWS CloudFormation template +func (t *Template) GetAllAWSSNSSubscriptionResources() map[string]AWSSNSSubscription { + results := map[string]AWSSNSSubscription{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSNSSubscription: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SNS::Subscription" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSNSSubscription + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSNSSubscriptionWithName retrieves all AWSSNSSubscription items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSNSSubscriptionWithName(name string) (AWSSNSSubscription, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSNSSubscription: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SNS::Subscription" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSNSSubscription + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSNSSubscription{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topic.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topic.go new file mode 100644 index 0000000000..68562fa86e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topic.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSNSTopic AWS CloudFormation Resource (AWS::SNS::Topic) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html +type AWSSNSTopic struct { + + // DisplayName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html#cfn-sns-topic-displayname + DisplayName string `json:"DisplayName,omitempty"` + + // Subscription AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html#cfn-sns-topic-subscription + Subscription []AWSSNSTopic_Subscription `json:"Subscription,omitempty"` + + // TopicName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html#cfn-sns-topic-topicname + TopicName string `json:"TopicName,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSNSTopic) AWSCloudFormationType() string { + return "AWS::SNS::Topic" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSNSTopic) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSNSTopic) MarshalJSON() ([]byte, error) { + type Properties AWSSNSTopic + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSNSTopic) UnmarshalJSON(b []byte) error { + type Properties AWSSNSTopic + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSNSTopic(*res.Properties) + } + + return nil +} + +// GetAllAWSSNSTopicResources retrieves all AWSSNSTopic items from an AWS CloudFormation template +func (t *Template) GetAllAWSSNSTopicResources() map[string]AWSSNSTopic { + results := map[string]AWSSNSTopic{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSNSTopic: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SNS::Topic" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSNSTopic + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSNSTopicWithName retrieves all AWSSNSTopic items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSNSTopicWithName(name string) (AWSSNSTopic, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSNSTopic: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SNS::Topic" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSNSTopic + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSNSTopic{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topic_subscription.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topic_subscription.go new file mode 100644 index 0000000000..9b644655e4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topic_subscription.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSSNSTopic_Subscription AWS CloudFormation Resource (AWS::SNS::Topic.Subscription) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-subscription.html +type AWSSNSTopic_Subscription struct { + + // Endpoint AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-subscription.html#cfn-sns-topic-subscription-endpoint + Endpoint string `json:"Endpoint,omitempty"` + + // Protocol AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-subscription.html#cfn-sns-topic-subscription-protocol + Protocol string `json:"Protocol,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSNSTopic_Subscription) AWSCloudFormationType() string { + return "AWS::SNS::Topic.Subscription" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSNSTopic_Subscription) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topicpolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topicpolicy.go new file mode 100644 index 0000000000..0c21410394 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topicpolicy.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSNSTopicPolicy AWS CloudFormation Resource (AWS::SNS::TopicPolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html +type AWSSNSTopicPolicy struct { + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html#cfn-sns-topicpolicy-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // Topics AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html#cfn-sns-topicpolicy-topics + Topics []string `json:"Topics,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSNSTopicPolicy) AWSCloudFormationType() string { + return "AWS::SNS::TopicPolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSNSTopicPolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSNSTopicPolicy) MarshalJSON() ([]byte, error) { + type Properties AWSSNSTopicPolicy + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSNSTopicPolicy) UnmarshalJSON(b []byte) error { + type Properties AWSSNSTopicPolicy + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSNSTopicPolicy(*res.Properties) + } + + return nil +} + +// GetAllAWSSNSTopicPolicyResources retrieves all AWSSNSTopicPolicy items from an AWS CloudFormation template +func (t *Template) GetAllAWSSNSTopicPolicyResources() map[string]AWSSNSTopicPolicy { + results := map[string]AWSSNSTopicPolicy{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSNSTopicPolicy: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SNS::TopicPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSNSTopicPolicy + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSNSTopicPolicyWithName retrieves all AWSSNSTopicPolicy items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSNSTopicPolicyWithName(name string) (AWSSNSTopicPolicy, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSNSTopicPolicy: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SNS::TopicPolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSNSTopicPolicy + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSNSTopicPolicy{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sqs-queue.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sqs-queue.go new file mode 100644 index 0000000000..68a48c5060 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sqs-queue.go @@ -0,0 +1,155 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSQSQueue AWS CloudFormation Resource (AWS::SQS::Queue) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html +type AWSSQSQueue struct { + + // ContentBasedDeduplication AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-contentbaseddeduplication + ContentBasedDeduplication bool `json:"ContentBasedDeduplication,omitempty"` + + // DelaySeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-delayseconds + DelaySeconds int `json:"DelaySeconds,omitempty"` + + // FifoQueue AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-fifoqueue + FifoQueue bool `json:"FifoQueue,omitempty"` + + // MaximumMessageSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-maxmesgsize + MaximumMessageSize int `json:"MaximumMessageSize,omitempty"` + + // MessageRetentionPeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-msgretentionperiod + MessageRetentionPeriod int `json:"MessageRetentionPeriod,omitempty"` + + // QueueName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-name + QueueName string `json:"QueueName,omitempty"` + + // ReceiveMessageWaitTimeSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-receivemsgwaittime + ReceiveMessageWaitTimeSeconds int `json:"ReceiveMessageWaitTimeSeconds,omitempty"` + + // RedrivePolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-redrive + RedrivePolicy interface{} `json:"RedrivePolicy,omitempty"` + + // VisibilityTimeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-visiblitytimeout + VisibilityTimeout int `json:"VisibilityTimeout,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSQSQueue) AWSCloudFormationType() string { + return "AWS::SQS::Queue" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSQSQueue) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSQSQueue) MarshalJSON() ([]byte, error) { + type Properties AWSSQSQueue + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSQSQueue) UnmarshalJSON(b []byte) error { + type Properties AWSSQSQueue + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSQSQueue(*res.Properties) + } + + return nil +} + +// GetAllAWSSQSQueueResources retrieves all AWSSQSQueue items from an AWS CloudFormation template +func (t *Template) GetAllAWSSQSQueueResources() map[string]AWSSQSQueue { + results := map[string]AWSSQSQueue{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSQSQueue: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SQS::Queue" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSQSQueue + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSQSQueueWithName retrieves all AWSSQSQueue items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSQSQueueWithName(name string) (AWSSQSQueue, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSQSQueue: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SQS::Queue" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSQSQueue + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSQSQueue{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sqs-queuepolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sqs-queuepolicy.go new file mode 100644 index 0000000000..8037afe0b2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sqs-queuepolicy.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSQSQueuePolicy AWS CloudFormation Resource (AWS::SQS::QueuePolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-policy.html +type AWSSQSQueuePolicy struct { + + // PolicyDocument AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-policy.html#cfn-sqs-queuepolicy-policydoc + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // Queues AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-policy.html#cfn-sqs-queuepolicy-queues + Queues []string `json:"Queues,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSQSQueuePolicy) AWSCloudFormationType() string { + return "AWS::SQS::QueuePolicy" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSQSQueuePolicy) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSQSQueuePolicy) MarshalJSON() ([]byte, error) { + type Properties AWSSQSQueuePolicy + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSQSQueuePolicy) UnmarshalJSON(b []byte) error { + type Properties AWSSQSQueuePolicy + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSQSQueuePolicy(*res.Properties) + } + + return nil +} + +// GetAllAWSSQSQueuePolicyResources retrieves all AWSSQSQueuePolicy items from an AWS CloudFormation template +func (t *Template) GetAllAWSSQSQueuePolicyResources() map[string]AWSSQSQueuePolicy { + results := map[string]AWSSQSQueuePolicy{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSQSQueuePolicy: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SQS::QueuePolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSQSQueuePolicy + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSQSQueuePolicyWithName retrieves all AWSSQSQueuePolicy items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSQSQueuePolicyWithName(name string) (AWSSQSQueuePolicy, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSQSQueuePolicy: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SQS::QueuePolicy" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSQSQueuePolicy + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSQSQueuePolicy{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association.go new file mode 100644 index 0000000000..e0c2228f2d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSSMAssociation AWS CloudFormation Resource (AWS::SSM::Association) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html +type AWSSSMAssociation struct { + + // DocumentVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-documentversion + DocumentVersion string `json:"DocumentVersion,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-instanceid + InstanceId string `json:"InstanceId,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-name + Name string `json:"Name,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-parameters + Parameters map[string]AWSSSMAssociation_ParameterValues `json:"Parameters,omitempty"` + + // ScheduleExpression AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-scheduleexpression + ScheduleExpression string `json:"ScheduleExpression,omitempty"` + + // Targets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-targets + Targets []AWSSSMAssociation_Target `json:"Targets,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMAssociation) AWSCloudFormationType() string { + return "AWS::SSM::Association" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSSMAssociation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSSMAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSSSMAssociation + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSSMAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSSSMAssociation + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSSMAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSSSMAssociationResources retrieves all AWSSSMAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSSSMAssociationResources() map[string]AWSSSMAssociation { + results := map[string]AWSSSMAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSSMAssociation: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SSM::Association" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSSMAssociationWithName retrieves all AWSSSMAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSSMAssociationWithName(name string) (AWSSSMAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSSMAssociation: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SSM::Association" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSSMAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_parametervalues.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_parametervalues.go new file mode 100644 index 0000000000..fbbd1f5e18 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_parametervalues.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSSSMAssociation_ParameterValues AWS CloudFormation Resource (AWS::SSM::Association.ParameterValues) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-parametervalues.html +type AWSSSMAssociation_ParameterValues struct { + + // ParameterValues AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-parametervalues.html#cfn-ssm-association-parametervalues-parametervalues + ParameterValues []string `json:"ParameterValues,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMAssociation_ParameterValues) AWSCloudFormationType() string { + return "AWS::SSM::Association.ParameterValues" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSSMAssociation_ParameterValues) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_target.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_target.go new file mode 100644 index 0000000000..3f844bc232 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_target.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSSSMAssociation_Target AWS CloudFormation Resource (AWS::SSM::Association.Target) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-target.html +type AWSSSMAssociation_Target struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-target.html#cfn-ssm-association-target-key + Key string `json:"Key,omitempty"` + + // Values AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-target.html#cfn-ssm-association-target-values + Values []string `json:"Values,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMAssociation_Target) AWSCloudFormationType() string { + return "AWS::SSM::Association.Target" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSSMAssociation_Target) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-document.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-document.go new file mode 100644 index 0000000000..bb49a91b13 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-document.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSSMDocument AWS CloudFormation Resource (AWS::SSM::Document) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html +type AWSSSMDocument struct { + + // Content AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-content + Content interface{} `json:"Content,omitempty"` + + // DocumentType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-documenttype + DocumentType string `json:"DocumentType,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMDocument) AWSCloudFormationType() string { + return "AWS::SSM::Document" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSSMDocument) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSSMDocument) MarshalJSON() ([]byte, error) { + type Properties AWSSSMDocument + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSSMDocument) UnmarshalJSON(b []byte) error { + type Properties AWSSSMDocument + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSSMDocument(*res.Properties) + } + + return nil +} + +// GetAllAWSSSMDocumentResources retrieves all AWSSSMDocument items from an AWS CloudFormation template +func (t *Template) GetAllAWSSSMDocumentResources() map[string]AWSSSMDocument { + results := map[string]AWSSSMDocument{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSSMDocument: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SSM::Document" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMDocument + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSSMDocumentWithName retrieves all AWSSSMDocument items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSSMDocumentWithName(name string) (AWSSSMDocument, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSSMDocument: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SSM::Document" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMDocument + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSSMDocument{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-parameter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-parameter.go new file mode 100644 index 0000000000..f2344a284a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-parameter.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSSMParameter AWS CloudFormation Resource (AWS::SSM::Parameter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html +type AWSSSMParameter struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-name + Name string `json:"Name,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-type + Type string `json:"Type,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMParameter) AWSCloudFormationType() string { + return "AWS::SSM::Parameter" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSSSMParameter) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSSSMParameter) MarshalJSON() ([]byte, error) { + type Properties AWSSSMParameter + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSSMParameter) UnmarshalJSON(b []byte) error { + type Properties AWSSSMParameter + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSSSMParameter(*res.Properties) + } + + return nil +} + +// GetAllAWSSSMParameterResources retrieves all AWSSSMParameter items from an AWS CloudFormation template +func (t *Template) GetAllAWSSSMParameterResources() map[string]AWSSSMParameter { + results := map[string]AWSSSMParameter{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSSMParameter: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SSM::Parameter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMParameter + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSSMParameterWithName retrieves all AWSSSMParameter items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSSMParameterWithName(name string) (AWSSSMParameter, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSSMParameter: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::SSM::Parameter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMParameter + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSSMParameter{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-stepfunctions-activity.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-stepfunctions-activity.go new file mode 100644 index 0000000000..bd08b0a704 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-stepfunctions-activity.go @@ -0,0 +1,115 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSStepFunctionsActivity AWS CloudFormation Resource (AWS::StepFunctions::Activity) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-activity.html +type AWSStepFunctionsActivity struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-activity.html#cfn-stepfunctions-activity-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSStepFunctionsActivity) AWSCloudFormationType() string { + return "AWS::StepFunctions::Activity" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSStepFunctionsActivity) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSStepFunctionsActivity) MarshalJSON() ([]byte, error) { + type Properties AWSStepFunctionsActivity + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSStepFunctionsActivity) UnmarshalJSON(b []byte) error { + type Properties AWSStepFunctionsActivity + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSStepFunctionsActivity(*res.Properties) + } + + return nil +} + +// GetAllAWSStepFunctionsActivityResources retrieves all AWSStepFunctionsActivity items from an AWS CloudFormation template +func (t *Template) GetAllAWSStepFunctionsActivityResources() map[string]AWSStepFunctionsActivity { + results := map[string]AWSStepFunctionsActivity{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSStepFunctionsActivity: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::StepFunctions::Activity" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSStepFunctionsActivity + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSStepFunctionsActivityWithName retrieves all AWSStepFunctionsActivity items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSStepFunctionsActivityWithName(name string) (AWSStepFunctionsActivity, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSStepFunctionsActivity: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::StepFunctions::Activity" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSStepFunctionsActivity + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSStepFunctionsActivity{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-stepfunctions-statemachine.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-stepfunctions-statemachine.go new file mode 100644 index 0000000000..5c4b8358eb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-stepfunctions-statemachine.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSStepFunctionsStateMachine AWS CloudFormation Resource (AWS::StepFunctions::StateMachine) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html +type AWSStepFunctionsStateMachine struct { + + // DefinitionString AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-definitionstring + DefinitionString string `json:"DefinitionString,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-rolearn + RoleArn string `json:"RoleArn,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSStepFunctionsStateMachine) AWSCloudFormationType() string { + return "AWS::StepFunctions::StateMachine" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSStepFunctionsStateMachine) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSStepFunctionsStateMachine) MarshalJSON() ([]byte, error) { + type Properties AWSStepFunctionsStateMachine + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSStepFunctionsStateMachine) UnmarshalJSON(b []byte) error { + type Properties AWSStepFunctionsStateMachine + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSStepFunctionsStateMachine(*res.Properties) + } + + return nil +} + +// GetAllAWSStepFunctionsStateMachineResources retrieves all AWSStepFunctionsStateMachine items from an AWS CloudFormation template +func (t *Template) GetAllAWSStepFunctionsStateMachineResources() map[string]AWSStepFunctionsStateMachine { + results := map[string]AWSStepFunctionsStateMachine{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSStepFunctionsStateMachine: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::StepFunctions::StateMachine" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSStepFunctionsStateMachine + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSStepFunctionsStateMachineWithName retrieves all AWSStepFunctionsStateMachine items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSStepFunctionsStateMachineWithName(name string) (AWSStepFunctionsStateMachine, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSStepFunctionsStateMachine: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::StepFunctions::StateMachine" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSStepFunctionsStateMachine + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSStepFunctionsStateMachine{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset.go new file mode 100644 index 0000000000..6f85708bd1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFByteMatchSet AWS CloudFormation Resource (AWS::WAF::ByteMatchSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-bytematchset.html +type AWSWAFByteMatchSet struct { + + // ByteMatchTuples AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-bytematchset.html#cfn-waf-bytematchset-bytematchtuples + ByteMatchTuples []AWSWAFByteMatchSet_ByteMatchTuple `json:"ByteMatchTuples,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-bytematchset.html#cfn-waf-bytematchset-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFByteMatchSet) AWSCloudFormationType() string { + return "AWS::WAF::ByteMatchSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFByteMatchSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFByteMatchSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFByteMatchSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFByteMatchSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFByteMatchSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFByteMatchSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFByteMatchSetResources retrieves all AWSWAFByteMatchSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFByteMatchSetResources() map[string]AWSWAFByteMatchSet { + results := map[string]AWSWAFByteMatchSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFByteMatchSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::ByteMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFByteMatchSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFByteMatchSetWithName retrieves all AWSWAFByteMatchSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFByteMatchSetWithName(name string) (AWSWAFByteMatchSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFByteMatchSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::ByteMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFByteMatchSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFByteMatchSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset_bytematchtuple.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset_bytematchtuple.go new file mode 100644 index 0000000000..d8089ef838 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset_bytematchtuple.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSWAFByteMatchSet_ByteMatchTuple AWS CloudFormation Resource (AWS::WAF::ByteMatchSet.ByteMatchTuple) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples.html +type AWSWAFByteMatchSet_ByteMatchTuple struct { + + // FieldToMatch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples.html#cfn-waf-bytematchset-bytematchtuples-fieldtomatch + FieldToMatch *AWSWAFByteMatchSet_FieldToMatch `json:"FieldToMatch,omitempty"` + + // PositionalConstraint AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples.html#cfn-waf-bytematchset-bytematchtuples-positionalconstraint + PositionalConstraint string `json:"PositionalConstraint,omitempty"` + + // TargetString AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples.html#cfn-waf-bytematchset-bytematchtuples-targetstring + TargetString string `json:"TargetString,omitempty"` + + // TargetStringBase64 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples.html#cfn-waf-bytematchset-bytematchtuples-targetstringbase64 + TargetStringBase64 string `json:"TargetStringBase64,omitempty"` + + // TextTransformation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples.html#cfn-waf-bytematchset-bytematchtuples-texttransformation + TextTransformation string `json:"TextTransformation,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFByteMatchSet_ByteMatchTuple) AWSCloudFormationType() string { + return "AWS::WAF::ByteMatchSet.ByteMatchTuple" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFByteMatchSet_ByteMatchTuple) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset_fieldtomatch.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset_fieldtomatch.go new file mode 100644 index 0000000000..87042cf750 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset_fieldtomatch.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFByteMatchSet_FieldToMatch AWS CloudFormation Resource (AWS::WAF::ByteMatchSet.FieldToMatch) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples-fieldtomatch.html +type AWSWAFByteMatchSet_FieldToMatch struct { + + // Data AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples-fieldtomatch.html#cfn-waf-bytematchset-bytematchtuples-fieldtomatch-data + Data string `json:"Data,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples-fieldtomatch.html#cfn-waf-bytematchset-bytematchtuples-fieldtomatch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFByteMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAF::ByteMatchSet.FieldToMatch" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFByteMatchSet_FieldToMatch) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-ipset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-ipset.go new file mode 100644 index 0000000000..cdb58153af --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-ipset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFIPSet AWS CloudFormation Resource (AWS::WAF::IPSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-ipset.html +type AWSWAFIPSet struct { + + // IPSetDescriptors AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-ipset.html#cfn-waf-ipset-ipsetdescriptors + IPSetDescriptors []AWSWAFIPSet_IPSetDescriptor `json:"IPSetDescriptors,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-ipset.html#cfn-waf-ipset-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFIPSet) AWSCloudFormationType() string { + return "AWS::WAF::IPSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFIPSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFIPSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFIPSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFIPSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFIPSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFIPSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFIPSetResources retrieves all AWSWAFIPSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFIPSetResources() map[string]AWSWAFIPSet { + results := map[string]AWSWAFIPSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFIPSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::IPSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFIPSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFIPSetWithName retrieves all AWSWAFIPSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFIPSetWithName(name string) (AWSWAFIPSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFIPSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::IPSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFIPSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFIPSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-ipset_ipsetdescriptor.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-ipset_ipsetdescriptor.go new file mode 100644 index 0000000000..a3003dca8f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-ipset_ipsetdescriptor.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFIPSet_IPSetDescriptor AWS CloudFormation Resource (AWS::WAF::IPSet.IPSetDescriptor) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-ipset-ipsetdescriptors.html +type AWSWAFIPSet_IPSetDescriptor struct { + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-ipset-ipsetdescriptors.html#cfn-waf-ipset-ipsetdescriptors-type + Type string `json:"Type,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-ipset-ipsetdescriptors.html#cfn-waf-ipset-ipsetdescriptors-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFIPSet_IPSetDescriptor) AWSCloudFormationType() string { + return "AWS::WAF::IPSet.IPSetDescriptor" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFIPSet_IPSetDescriptor) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-rule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-rule.go new file mode 100644 index 0000000000..fbdeddb25d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-rule.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRule AWS CloudFormation Resource (AWS::WAF::Rule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html +type AWSWAFRule struct { + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html#cfn-waf-rule-metricname + MetricName string `json:"MetricName,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html#cfn-waf-rule-name + Name string `json:"Name,omitempty"` + + // Predicates AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html#cfn-waf-rule-predicates + Predicates []AWSWAFRule_Predicate `json:"Predicates,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRule) AWSCloudFormationType() string { + return "AWS::WAF::Rule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRule) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRule + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRule) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRule + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRule(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRuleResources retrieves all AWSWAFRule items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRuleResources() map[string]AWSWAFRule { + results := map[string]AWSWAFRule{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRule: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::Rule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRule + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRuleWithName retrieves all AWSWAFRule items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRuleWithName(name string) (AWSWAFRule, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRule: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::Rule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRule + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRule{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-rule_predicate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-rule_predicate.go new file mode 100644 index 0000000000..1306f322c7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-rule_predicate.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSWAFRule_Predicate AWS CloudFormation Resource (AWS::WAF::Rule.Predicate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-rule-predicates.html +type AWSWAFRule_Predicate struct { + + // DataId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-rule-predicates.html#cfn-waf-rule-predicates-dataid + DataId string `json:"DataId,omitempty"` + + // Negated AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-rule-predicates.html#cfn-waf-rule-predicates-negated + Negated bool `json:"Negated,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-rule-predicates.html#cfn-waf-rule-predicates-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRule_Predicate) AWSCloudFormationType() string { + return "AWS::WAF::Rule.Predicate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRule_Predicate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset.go new file mode 100644 index 0000000000..d67b012af3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFSizeConstraintSet AWS CloudFormation Resource (AWS::WAF::SizeConstraintSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-sizeconstraintset.html +type AWSWAFSizeConstraintSet struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-sizeconstraintset.html#cfn-waf-sizeconstraintset-name + Name string `json:"Name,omitempty"` + + // SizeConstraints AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-sizeconstraintset.html#cfn-waf-sizeconstraintset-sizeconstraints + SizeConstraints []AWSWAFSizeConstraintSet_SizeConstraint `json:"SizeConstraints,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSizeConstraintSet) AWSCloudFormationType() string { + return "AWS::WAF::SizeConstraintSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFSizeConstraintSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFSizeConstraintSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFSizeConstraintSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFSizeConstraintSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFSizeConstraintSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFSizeConstraintSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFSizeConstraintSetResources retrieves all AWSWAFSizeConstraintSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFSizeConstraintSetResources() map[string]AWSWAFSizeConstraintSet { + results := map[string]AWSWAFSizeConstraintSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFSizeConstraintSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::SizeConstraintSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFSizeConstraintSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFSizeConstraintSetWithName retrieves all AWSWAFSizeConstraintSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFSizeConstraintSetWithName(name string) (AWSWAFSizeConstraintSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFSizeConstraintSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::SizeConstraintSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFSizeConstraintSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFSizeConstraintSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset_fieldtomatch.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset_fieldtomatch.go new file mode 100644 index 0000000000..a056bebc5a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset_fieldtomatch.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFSizeConstraintSet_FieldToMatch AWS CloudFormation Resource (AWS::WAF::SizeConstraintSet.FieldToMatch) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html +type AWSWAFSizeConstraintSet_FieldToMatch struct { + + // Data AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html#cfn-waf-sizeconstraintset-sizeconstraint-fieldtomatch-data + Data string `json:"Data,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html#cfn-waf-sizeconstraintset-sizeconstraint-fieldtomatch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSizeConstraintSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAF::SizeConstraintSet.FieldToMatch" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFSizeConstraintSet_FieldToMatch) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset_sizeconstraint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset_sizeconstraint.go new file mode 100644 index 0000000000..ad43b062fb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset_sizeconstraint.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSWAFSizeConstraintSet_SizeConstraint AWS CloudFormation Resource (AWS::WAF::SizeConstraintSet.SizeConstraint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint.html +type AWSWAFSizeConstraintSet_SizeConstraint struct { + + // ComparisonOperator AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint.html#cfn-waf-sizeconstraintset-sizeconstraint-comparisonoperator + ComparisonOperator string `json:"ComparisonOperator,omitempty"` + + // FieldToMatch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint.html#cfn-waf-sizeconstraintset-sizeconstraint-fieldtomatch + FieldToMatch *AWSWAFSizeConstraintSet_FieldToMatch `json:"FieldToMatch,omitempty"` + + // Size AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint.html#cfn-waf-sizeconstraintset-sizeconstraint-size + Size int `json:"Size,omitempty"` + + // TextTransformation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint.html#cfn-waf-sizeconstraintset-sizeconstraint-texttransformation + TextTransformation string `json:"TextTransformation,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSizeConstraintSet_SizeConstraint) AWSCloudFormationType() string { + return "AWS::WAF::SizeConstraintSet.SizeConstraint" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFSizeConstraintSet_SizeConstraint) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset.go new file mode 100644 index 0000000000..1fa2ea1598 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFSqlInjectionMatchSet AWS CloudFormation Resource (AWS::WAF::SqlInjectionMatchSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-sqlinjectionmatchset.html +type AWSWAFSqlInjectionMatchSet struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-sqlinjectionmatchset.html#cfn-waf-sqlinjectionmatchset-name + Name string `json:"Name,omitempty"` + + // SqlInjectionMatchTuples AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-sqlinjectionmatchset.html#cfn-waf-sqlinjectionmatchset-sqlinjectionmatchtuples + SqlInjectionMatchTuples []AWSWAFSqlInjectionMatchSet_SqlInjectionMatchTuple `json:"SqlInjectionMatchTuples,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSqlInjectionMatchSet) AWSCloudFormationType() string { + return "AWS::WAF::SqlInjectionMatchSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFSqlInjectionMatchSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFSqlInjectionMatchSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFSqlInjectionMatchSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFSqlInjectionMatchSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFSqlInjectionMatchSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFSqlInjectionMatchSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFSqlInjectionMatchSetResources retrieves all AWSWAFSqlInjectionMatchSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFSqlInjectionMatchSetResources() map[string]AWSWAFSqlInjectionMatchSet { + results := map[string]AWSWAFSqlInjectionMatchSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFSqlInjectionMatchSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::SqlInjectionMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFSqlInjectionMatchSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFSqlInjectionMatchSetWithName retrieves all AWSWAFSqlInjectionMatchSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFSqlInjectionMatchSetWithName(name string) (AWSWAFSqlInjectionMatchSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFSqlInjectionMatchSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::SqlInjectionMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFSqlInjectionMatchSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFSqlInjectionMatchSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset_fieldtomatch.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset_fieldtomatch.go new file mode 100644 index 0000000000..58a2c1d280 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset_fieldtomatch.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFSqlInjectionMatchSet_FieldToMatch AWS CloudFormation Resource (AWS::WAF::SqlInjectionMatchSet.FieldToMatch) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples-fieldtomatch.html +type AWSWAFSqlInjectionMatchSet_FieldToMatch struct { + + // Data AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples-fieldtomatch.html#cfn-waf-sizeconstraintset-sizeconstraint-fieldtomatch-data + Data string `json:"Data,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-bytematchset-bytematchtuples-fieldtomatch.html#cfn-waf-sizeconstraintset-sizeconstraint-fieldtomatch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSqlInjectionMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAF::SqlInjectionMatchSet.FieldToMatch" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFSqlInjectionMatchSet_FieldToMatch) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset_sqlinjectionmatchtuple.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset_sqlinjectionmatchtuple.go new file mode 100644 index 0000000000..9603835244 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset_sqlinjectionmatchtuple.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFSqlInjectionMatchSet_SqlInjectionMatchTuple AWS CloudFormation Resource (AWS::WAF::SqlInjectionMatchSet.SqlInjectionMatchTuple) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sqlinjectionmatchset-sqlinjectionmatchtuples.html +type AWSWAFSqlInjectionMatchSet_SqlInjectionMatchTuple struct { + + // FieldToMatch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sqlinjectionmatchset-sqlinjectionmatchtuples.html#cfn-waf-sqlinjectionmatchset-sqlinjectionmatchtuples-fieldtomatch + FieldToMatch *AWSWAFSqlInjectionMatchSet_FieldToMatch `json:"FieldToMatch,omitempty"` + + // TextTransformation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sqlinjectionmatchset-sqlinjectionmatchtuples.html#cfn-waf-sqlinjectionmatchset-sqlinjectionmatchtuples-texttransformation + TextTransformation string `json:"TextTransformation,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSqlInjectionMatchSet_SqlInjectionMatchTuple) AWSCloudFormationType() string { + return "AWS::WAF::SqlInjectionMatchSet.SqlInjectionMatchTuple" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFSqlInjectionMatchSet_SqlInjectionMatchTuple) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl.go new file mode 100644 index 0000000000..98c9173278 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFWebACL AWS CloudFormation Resource (AWS::WAF::WebACL) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-webacl.html +type AWSWAFWebACL struct { + + // DefaultAction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-webacl.html#cfn-waf-webacl-defaultaction + DefaultAction *AWSWAFWebACL_WafAction `json:"DefaultAction,omitempty"` + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-webacl.html#cfn-waf-webacl-metricname + MetricName string `json:"MetricName,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-webacl.html#cfn-waf-webacl-name + Name string `json:"Name,omitempty"` + + // Rules AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-webacl.html#cfn-waf-webacl-rules + Rules []AWSWAFWebACL_ActivatedRule `json:"Rules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFWebACL) AWSCloudFormationType() string { + return "AWS::WAF::WebACL" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFWebACL) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFWebACL) MarshalJSON() ([]byte, error) { + type Properties AWSWAFWebACL + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFWebACL) UnmarshalJSON(b []byte) error { + type Properties AWSWAFWebACL + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFWebACL(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFWebACLResources retrieves all AWSWAFWebACL items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFWebACLResources() map[string]AWSWAFWebACL { + results := map[string]AWSWAFWebACL{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFWebACL: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::WebACL" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFWebACL + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFWebACLWithName retrieves all AWSWAFWebACL items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFWebACLWithName(name string) (AWSWAFWebACL, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFWebACL: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::WebACL" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFWebACL + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFWebACL{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl_activatedrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl_activatedrule.go new file mode 100644 index 0000000000..afe98b7a4c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl_activatedrule.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSWAFWebACL_ActivatedRule AWS CloudFormation Resource (AWS::WAF::WebACL.ActivatedRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-webacl-rules.html +type AWSWAFWebACL_ActivatedRule struct { + + // Action AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-webacl-rules.html#cfn-waf-webacl-rules-action + Action *AWSWAFWebACL_WafAction `json:"Action,omitempty"` + + // Priority AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-webacl-rules.html#cfn-waf-webacl-rules-priority + Priority int `json:"Priority,omitempty"` + + // RuleId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-webacl-rules.html#cfn-waf-webacl-rules-ruleid + RuleId string `json:"RuleId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFWebACL_ActivatedRule) AWSCloudFormationType() string { + return "AWS::WAF::WebACL.ActivatedRule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFWebACL_ActivatedRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl_wafaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl_wafaction.go new file mode 100644 index 0000000000..cff50a0414 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl_wafaction.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSWAFWebACL_WafAction AWS CloudFormation Resource (AWS::WAF::WebACL.WafAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-webacl-action.html +type AWSWAFWebACL_WafAction struct { + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-webacl-action.html#cfn-waf-webacl-action-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFWebACL_WafAction) AWSCloudFormationType() string { + return "AWS::WAF::WebACL.WafAction" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFWebACL_WafAction) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset.go new file mode 100644 index 0000000000..4f8a72d407 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFXssMatchSet AWS CloudFormation Resource (AWS::WAF::XssMatchSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-xssmatchset.html +type AWSWAFXssMatchSet struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-xssmatchset.html#cfn-waf-xssmatchset-name + Name string `json:"Name,omitempty"` + + // XssMatchTuples AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-xssmatchset.html#cfn-waf-xssmatchset-xssmatchtuples + XssMatchTuples []AWSWAFXssMatchSet_XssMatchTuple `json:"XssMatchTuples,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFXssMatchSet) AWSCloudFormationType() string { + return "AWS::WAF::XssMatchSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFXssMatchSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFXssMatchSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFXssMatchSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFXssMatchSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFXssMatchSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFXssMatchSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFXssMatchSetResources retrieves all AWSWAFXssMatchSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFXssMatchSetResources() map[string]AWSWAFXssMatchSet { + results := map[string]AWSWAFXssMatchSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFXssMatchSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::XssMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFXssMatchSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFXssMatchSetWithName retrieves all AWSWAFXssMatchSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFXssMatchSetWithName(name string) (AWSWAFXssMatchSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFXssMatchSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAF::XssMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFXssMatchSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFXssMatchSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset_fieldtomatch.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset_fieldtomatch.go new file mode 100644 index 0000000000..f95909c824 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset_fieldtomatch.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFXssMatchSet_FieldToMatch AWS CloudFormation Resource (AWS::WAF::XssMatchSet.FieldToMatch) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-xssmatchset-xssmatchtuple-fieldtomatch.html +type AWSWAFXssMatchSet_FieldToMatch struct { + + // Data AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-xssmatchset-xssmatchtuple-fieldtomatch.html#cfn-waf-xssmatchset-xssmatchtuple-fieldtomatch-data + Data string `json:"Data,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-xssmatchset-xssmatchtuple-fieldtomatch.html#cfn-waf-xssmatchset-xssmatchtuple-fieldtomatch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFXssMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAF::XssMatchSet.FieldToMatch" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFXssMatchSet_FieldToMatch) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset_xssmatchtuple.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset_xssmatchtuple.go new file mode 100644 index 0000000000..f37b991269 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset_xssmatchtuple.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFXssMatchSet_XssMatchTuple AWS CloudFormation Resource (AWS::WAF::XssMatchSet.XssMatchTuple) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-xssmatchset-xssmatchtuple.html +type AWSWAFXssMatchSet_XssMatchTuple struct { + + // FieldToMatch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-xssmatchset-xssmatchtuple.html#cfn-waf-xssmatchset-xssmatchtuple-fieldtomatch + FieldToMatch *AWSWAFXssMatchSet_FieldToMatch `json:"FieldToMatch,omitempty"` + + // TextTransformation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-xssmatchset-xssmatchtuple.html#cfn-waf-xssmatchset-xssmatchtuple-texttransformation + TextTransformation string `json:"TextTransformation,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFXssMatchSet_XssMatchTuple) AWSCloudFormationType() string { + return "AWS::WAF::XssMatchSet.XssMatchTuple" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFXssMatchSet_XssMatchTuple) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset.go new file mode 100644 index 0000000000..28060ebf63 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRegionalByteMatchSet AWS CloudFormation Resource (AWS::WAFRegional::ByteMatchSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-bytematchset.html +type AWSWAFRegionalByteMatchSet struct { + + // ByteMatchTuples AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-bytematchset.html#cfn-wafregional-bytematchset-bytematchtuples + ByteMatchTuples []AWSWAFRegionalByteMatchSet_ByteMatchTuple `json:"ByteMatchTuples,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-bytematchset.html#cfn-wafregional-bytematchset-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalByteMatchSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::ByteMatchSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalByteMatchSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRegionalByteMatchSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRegionalByteMatchSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRegionalByteMatchSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRegionalByteMatchSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRegionalByteMatchSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRegionalByteMatchSetResources retrieves all AWSWAFRegionalByteMatchSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRegionalByteMatchSetResources() map[string]AWSWAFRegionalByteMatchSet { + results := map[string]AWSWAFRegionalByteMatchSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRegionalByteMatchSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::ByteMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalByteMatchSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRegionalByteMatchSetWithName retrieves all AWSWAFRegionalByteMatchSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRegionalByteMatchSetWithName(name string) (AWSWAFRegionalByteMatchSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRegionalByteMatchSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::ByteMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalByteMatchSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRegionalByteMatchSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset_bytematchtuple.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset_bytematchtuple.go new file mode 100644 index 0000000000..60576923c3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset_bytematchtuple.go @@ -0,0 +1,41 @@ +package cloudformation + +// AWSWAFRegionalByteMatchSet_ByteMatchTuple AWS CloudFormation Resource (AWS::WAFRegional::ByteMatchSet.ByteMatchTuple) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-bytematchtuple.html +type AWSWAFRegionalByteMatchSet_ByteMatchTuple struct { + + // FieldToMatch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-bytematchtuple.html#cfn-wafregional-bytematchset-bytematchtuple-fieldtomatch + FieldToMatch *AWSWAFRegionalByteMatchSet_FieldToMatch `json:"FieldToMatch,omitempty"` + + // PositionalConstraint AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-bytematchtuple.html#cfn-wafregional-bytematchset-bytematchtuple-positionalconstraint + PositionalConstraint string `json:"PositionalConstraint,omitempty"` + + // TargetString AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-bytematchtuple.html#cfn-wafregional-bytematchset-bytematchtuple-targetstring + TargetString string `json:"TargetString,omitempty"` + + // TargetStringBase64 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-bytematchtuple.html#cfn-wafregional-bytematchset-bytematchtuple-targetstringbase64 + TargetStringBase64 string `json:"TargetStringBase64,omitempty"` + + // TextTransformation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-bytematchtuple.html#cfn-wafregional-bytematchset-bytematchtuple-texttransformation + TextTransformation string `json:"TextTransformation,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalByteMatchSet_ByteMatchTuple) AWSCloudFormationType() string { + return "AWS::WAFRegional::ByteMatchSet.ByteMatchTuple" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalByteMatchSet_ByteMatchTuple) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset_fieldtomatch.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset_fieldtomatch.go new file mode 100644 index 0000000000..b8c68de60d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset_fieldtomatch.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFRegionalByteMatchSet_FieldToMatch AWS CloudFormation Resource (AWS::WAFRegional::ByteMatchSet.FieldToMatch) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-fieldtomatch.html +type AWSWAFRegionalByteMatchSet_FieldToMatch struct { + + // Data AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-fieldtomatch.html#cfn-wafregional-bytematchset-fieldtomatch-data + Data string `json:"Data,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-bytematchset-fieldtomatch.html#cfn-wafregional-bytematchset-fieldtomatch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalByteMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAFRegional::ByteMatchSet.FieldToMatch" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalByteMatchSet_FieldToMatch) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-ipset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-ipset.go new file mode 100644 index 0000000000..07d030c792 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-ipset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRegionalIPSet AWS CloudFormation Resource (AWS::WAFRegional::IPSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-ipset.html +type AWSWAFRegionalIPSet struct { + + // IPSetDescriptors AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-ipset.html#cfn-wafregional-ipset-ipsetdescriptors + IPSetDescriptors []AWSWAFRegionalIPSet_IPSetDescriptor `json:"IPSetDescriptors,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-ipset.html#cfn-wafregional-ipset-name + Name string `json:"Name,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalIPSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::IPSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalIPSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRegionalIPSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRegionalIPSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRegionalIPSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRegionalIPSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRegionalIPSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRegionalIPSetResources retrieves all AWSWAFRegionalIPSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRegionalIPSetResources() map[string]AWSWAFRegionalIPSet { + results := map[string]AWSWAFRegionalIPSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRegionalIPSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::IPSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalIPSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRegionalIPSetWithName retrieves all AWSWAFRegionalIPSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRegionalIPSetWithName(name string) (AWSWAFRegionalIPSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRegionalIPSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::IPSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalIPSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRegionalIPSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-ipset_ipsetdescriptor.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-ipset_ipsetdescriptor.go new file mode 100644 index 0000000000..3504451b36 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-ipset_ipsetdescriptor.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFRegionalIPSet_IPSetDescriptor AWS CloudFormation Resource (AWS::WAFRegional::IPSet.IPSetDescriptor) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-ipset-ipsetdescriptor.html +type AWSWAFRegionalIPSet_IPSetDescriptor struct { + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-ipset-ipsetdescriptor.html#cfn-wafregional-ipset-ipsetdescriptor-type + Type string `json:"Type,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-ipset-ipsetdescriptor.html#cfn-wafregional-ipset-ipsetdescriptor-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalIPSet_IPSetDescriptor) AWSCloudFormationType() string { + return "AWS::WAFRegional::IPSet.IPSetDescriptor" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalIPSet_IPSetDescriptor) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-rule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-rule.go new file mode 100644 index 0000000000..ba4473ec40 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-rule.go @@ -0,0 +1,125 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRegionalRule AWS CloudFormation Resource (AWS::WAFRegional::Rule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html +type AWSWAFRegionalRule struct { + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html#cfn-wafregional-rule-metricname + MetricName string `json:"MetricName,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html#cfn-wafregional-rule-name + Name string `json:"Name,omitempty"` + + // Predicates AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html#cfn-wafregional-rule-predicates + Predicates []AWSWAFRegionalRule_Predicate `json:"Predicates,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalRule) AWSCloudFormationType() string { + return "AWS::WAFRegional::Rule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalRule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRegionalRule) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRegionalRule + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRegionalRule) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRegionalRule + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRegionalRule(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRegionalRuleResources retrieves all AWSWAFRegionalRule items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRegionalRuleResources() map[string]AWSWAFRegionalRule { + results := map[string]AWSWAFRegionalRule{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRegionalRule: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::Rule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalRule + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRegionalRuleWithName retrieves all AWSWAFRegionalRule items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRegionalRuleWithName(name string) (AWSWAFRegionalRule, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRegionalRule: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::Rule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalRule + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRegionalRule{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-rule_predicate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-rule_predicate.go new file mode 100644 index 0000000000..f3c024e3dc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-rule_predicate.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSWAFRegionalRule_Predicate AWS CloudFormation Resource (AWS::WAFRegional::Rule.Predicate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-rule-predicate.html +type AWSWAFRegionalRule_Predicate struct { + + // DataId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-rule-predicate.html#cfn-wafregional-rule-predicate-dataid + DataId string `json:"DataId,omitempty"` + + // Negated AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-rule-predicate.html#cfn-wafregional-rule-predicate-negated + Negated bool `json:"Negated,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-rule-predicate.html#cfn-wafregional-rule-predicate-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalRule_Predicate) AWSCloudFormationType() string { + return "AWS::WAFRegional::Rule.Predicate" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalRule_Predicate) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset.go new file mode 100644 index 0000000000..562dfb3fbb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRegionalSizeConstraintSet AWS CloudFormation Resource (AWS::WAFRegional::SizeConstraintSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-sizeconstraintset.html +type AWSWAFRegionalSizeConstraintSet struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-sizeconstraintset.html#cfn-wafregional-sizeconstraintset-name + Name string `json:"Name,omitempty"` + + // SizeConstraints AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-sizeconstraintset.html#cfn-wafregional-sizeconstraintset-sizeconstraints + SizeConstraints []AWSWAFRegionalSizeConstraintSet_SizeConstraint `json:"SizeConstraints,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSizeConstraintSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::SizeConstraintSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalSizeConstraintSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRegionalSizeConstraintSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRegionalSizeConstraintSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRegionalSizeConstraintSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRegionalSizeConstraintSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRegionalSizeConstraintSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRegionalSizeConstraintSetResources retrieves all AWSWAFRegionalSizeConstraintSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRegionalSizeConstraintSetResources() map[string]AWSWAFRegionalSizeConstraintSet { + results := map[string]AWSWAFRegionalSizeConstraintSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRegionalSizeConstraintSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::SizeConstraintSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalSizeConstraintSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRegionalSizeConstraintSetWithName retrieves all AWSWAFRegionalSizeConstraintSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRegionalSizeConstraintSetWithName(name string) (AWSWAFRegionalSizeConstraintSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRegionalSizeConstraintSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::SizeConstraintSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalSizeConstraintSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRegionalSizeConstraintSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset_fieldtomatch.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset_fieldtomatch.go new file mode 100644 index 0000000000..f243aa3def --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset_fieldtomatch.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFRegionalSizeConstraintSet_FieldToMatch AWS CloudFormation Resource (AWS::WAFRegional::SizeConstraintSet.FieldToMatch) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sizeconstraintset-fieldtomatch.html +type AWSWAFRegionalSizeConstraintSet_FieldToMatch struct { + + // Data AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sizeconstraintset-fieldtomatch.html#cfn-wafregional-sizeconstraintset-fieldtomatch-data + Data string `json:"Data,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sizeconstraintset-fieldtomatch.html#cfn-wafregional-sizeconstraintset-fieldtomatch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSizeConstraintSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAFRegional::SizeConstraintSet.FieldToMatch" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalSizeConstraintSet_FieldToMatch) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset_sizeconstraint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset_sizeconstraint.go new file mode 100644 index 0000000000..5d8548669d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset_sizeconstraint.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSWAFRegionalSizeConstraintSet_SizeConstraint AWS CloudFormation Resource (AWS::WAFRegional::SizeConstraintSet.SizeConstraint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sizeconstraintset-sizeconstraint.html +type AWSWAFRegionalSizeConstraintSet_SizeConstraint struct { + + // ComparisonOperator AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sizeconstraintset-sizeconstraint.html#cfn-wafregional-sizeconstraintset-sizeconstraint-comparisonoperator + ComparisonOperator string `json:"ComparisonOperator,omitempty"` + + // FieldToMatch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sizeconstraintset-sizeconstraint.html#cfn-wafregional-sizeconstraintset-sizeconstraint-fieldtomatch + FieldToMatch *AWSWAFRegionalSizeConstraintSet_FieldToMatch `json:"FieldToMatch,omitempty"` + + // Size AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sizeconstraintset-sizeconstraint.html#cfn-wafregional-sizeconstraintset-sizeconstraint-size + Size int `json:"Size,omitempty"` + + // TextTransformation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sizeconstraintset-sizeconstraint.html#cfn-wafregional-sizeconstraintset-sizeconstraint-texttransformation + TextTransformation string `json:"TextTransformation,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSizeConstraintSet_SizeConstraint) AWSCloudFormationType() string { + return "AWS::WAFRegional::SizeConstraintSet.SizeConstraint" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalSizeConstraintSet_SizeConstraint) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset.go new file mode 100644 index 0000000000..3075af0cba --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRegionalSqlInjectionMatchSet AWS CloudFormation Resource (AWS::WAFRegional::SqlInjectionMatchSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-sqlinjectionmatchset.html +type AWSWAFRegionalSqlInjectionMatchSet struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-sqlinjectionmatchset.html#cfn-wafregional-sqlinjectionmatchset-name + Name string `json:"Name,omitempty"` + + // SqlInjectionMatchTuples AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-sqlinjectionmatchset.html#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuples + SqlInjectionMatchTuples []AWSWAFRegionalSqlInjectionMatchSet_SqlInjectionMatchTuple `json:"SqlInjectionMatchTuples,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSqlInjectionMatchSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::SqlInjectionMatchSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalSqlInjectionMatchSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRegionalSqlInjectionMatchSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRegionalSqlInjectionMatchSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRegionalSqlInjectionMatchSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRegionalSqlInjectionMatchSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRegionalSqlInjectionMatchSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRegionalSqlInjectionMatchSetResources retrieves all AWSWAFRegionalSqlInjectionMatchSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRegionalSqlInjectionMatchSetResources() map[string]AWSWAFRegionalSqlInjectionMatchSet { + results := map[string]AWSWAFRegionalSqlInjectionMatchSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRegionalSqlInjectionMatchSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::SqlInjectionMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalSqlInjectionMatchSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRegionalSqlInjectionMatchSetWithName retrieves all AWSWAFRegionalSqlInjectionMatchSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRegionalSqlInjectionMatchSetWithName(name string) (AWSWAFRegionalSqlInjectionMatchSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRegionalSqlInjectionMatchSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::SqlInjectionMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalSqlInjectionMatchSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRegionalSqlInjectionMatchSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset_fieldtomatch.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset_fieldtomatch.go new file mode 100644 index 0000000000..3dd6551d4c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset_fieldtomatch.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFRegionalSqlInjectionMatchSet_FieldToMatch AWS CloudFormation Resource (AWS::WAFRegional::SqlInjectionMatchSet.FieldToMatch) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch.html +type AWSWAFRegionalSqlInjectionMatchSet_FieldToMatch struct { + + // Data AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch.html#cfn-wafregional-sqlinjectionmatchset-fieldtomatch-data + Data string `json:"Data,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch.html#cfn-wafregional-sqlinjectionmatchset-fieldtomatch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSqlInjectionMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAFRegional::SqlInjectionMatchSet.FieldToMatch" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalSqlInjectionMatchSet_FieldToMatch) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset_sqlinjectionmatchtuple.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset_sqlinjectionmatchtuple.go new file mode 100644 index 0000000000..96a618b233 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset_sqlinjectionmatchtuple.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFRegionalSqlInjectionMatchSet_SqlInjectionMatchTuple AWS CloudFormation Resource (AWS::WAFRegional::SqlInjectionMatchSet.SqlInjectionMatchTuple) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple.html +type AWSWAFRegionalSqlInjectionMatchSet_SqlInjectionMatchTuple struct { + + // FieldToMatch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple.html#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-fieldtomatch + FieldToMatch *AWSWAFRegionalSqlInjectionMatchSet_FieldToMatch `json:"FieldToMatch,omitempty"` + + // TextTransformation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple.html#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-texttransformation + TextTransformation string `json:"TextTransformation,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSqlInjectionMatchSet_SqlInjectionMatchTuple) AWSCloudFormationType() string { + return "AWS::WAFRegional::SqlInjectionMatchSet.SqlInjectionMatchTuple" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalSqlInjectionMatchSet_SqlInjectionMatchTuple) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl.go new file mode 100644 index 0000000000..056704c76d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl.go @@ -0,0 +1,130 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRegionalWebACL AWS CloudFormation Resource (AWS::WAFRegional::WebACL) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-webacl.html +type AWSWAFRegionalWebACL struct { + + // DefaultAction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-webacl.html#cfn-wafregional-webacl-defaultaction + DefaultAction *AWSWAFRegionalWebACL_Action `json:"DefaultAction,omitempty"` + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-webacl.html#cfn-wafregional-webacl-metricname + MetricName string `json:"MetricName,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-webacl.html#cfn-wafregional-webacl-name + Name string `json:"Name,omitempty"` + + // Rules AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-webacl.html#cfn-wafregional-webacl-rules + Rules []AWSWAFRegionalWebACL_Rule `json:"Rules,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalWebACL) AWSCloudFormationType() string { + return "AWS::WAFRegional::WebACL" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalWebACL) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRegionalWebACL) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRegionalWebACL + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRegionalWebACL) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRegionalWebACL + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRegionalWebACL(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRegionalWebACLResources retrieves all AWSWAFRegionalWebACL items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRegionalWebACLResources() map[string]AWSWAFRegionalWebACL { + results := map[string]AWSWAFRegionalWebACL{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRegionalWebACL: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::WebACL" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalWebACL + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRegionalWebACLWithName retrieves all AWSWAFRegionalWebACL items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRegionalWebACLWithName(name string) (AWSWAFRegionalWebACL, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRegionalWebACL: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::WebACL" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalWebACL + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRegionalWebACL{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl_action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl_action.go new file mode 100644 index 0000000000..73a94b6cda --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl_action.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSWAFRegionalWebACL_Action AWS CloudFormation Resource (AWS::WAFRegional::WebACL.Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-webacl-action.html +type AWSWAFRegionalWebACL_Action struct { + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-webacl-action.html#cfn-wafregional-webacl-action-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalWebACL_Action) AWSCloudFormationType() string { + return "AWS::WAFRegional::WebACL.Action" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalWebACL_Action) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl_rule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl_rule.go new file mode 100644 index 0000000000..0275c8b8f7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl_rule.go @@ -0,0 +1,31 @@ +package cloudformation + +// AWSWAFRegionalWebACL_Rule AWS CloudFormation Resource (AWS::WAFRegional::WebACL.Rule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-webacl-rule.html +type AWSWAFRegionalWebACL_Rule struct { + + // Action AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-webacl-rule.html#cfn-wafregional-webacl-rule-action + Action *AWSWAFRegionalWebACL_Action `json:"Action,omitempty"` + + // Priority AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-webacl-rule.html#cfn-wafregional-webacl-rule-priority + Priority int `json:"Priority,omitempty"` + + // RuleId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-webacl-rule.html#cfn-wafregional-webacl-rule-ruleid + RuleId string `json:"RuleId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalWebACL_Rule) AWSCloudFormationType() string { + return "AWS::WAFRegional::WebACL.Rule" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalWebACL_Rule) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webaclassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webaclassociation.go new file mode 100644 index 0000000000..d5d042d66e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webaclassociation.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRegionalWebACLAssociation AWS CloudFormation Resource (AWS::WAFRegional::WebACLAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-webaclassociation.html +type AWSWAFRegionalWebACLAssociation struct { + + // ResourceArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-webaclassociation.html#cfn-wafregional-webaclassociation-resourcearn + ResourceArn string `json:"ResourceArn,omitempty"` + + // WebACLId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-webaclassociation.html#cfn-wafregional-webaclassociation-webaclid + WebACLId string `json:"WebACLId,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalWebACLAssociation) AWSCloudFormationType() string { + return "AWS::WAFRegional::WebACLAssociation" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalWebACLAssociation) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRegionalWebACLAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRegionalWebACLAssociation + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRegionalWebACLAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRegionalWebACLAssociation + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRegionalWebACLAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRegionalWebACLAssociationResources retrieves all AWSWAFRegionalWebACLAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRegionalWebACLAssociationResources() map[string]AWSWAFRegionalWebACLAssociation { + results := map[string]AWSWAFRegionalWebACLAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRegionalWebACLAssociation: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::WebACLAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalWebACLAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRegionalWebACLAssociationWithName retrieves all AWSWAFRegionalWebACLAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRegionalWebACLAssociationWithName(name string) (AWSWAFRegionalWebACLAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRegionalWebACLAssociation: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::WebACLAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalWebACLAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRegionalWebACLAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset.go new file mode 100644 index 0000000000..df3a2f08a8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset.go @@ -0,0 +1,120 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWAFRegionalXssMatchSet AWS CloudFormation Resource (AWS::WAFRegional::XssMatchSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-xssmatchset.html +type AWSWAFRegionalXssMatchSet struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-xssmatchset.html#cfn-wafregional-xssmatchset-name + Name string `json:"Name,omitempty"` + + // XssMatchTuples AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-xssmatchset.html#cfn-wafregional-xssmatchset-xssmatchtuples + XssMatchTuples []AWSWAFRegionalXssMatchSet_XssMatchTuple `json:"XssMatchTuples,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalXssMatchSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::XssMatchSet" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalXssMatchSet) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWAFRegionalXssMatchSet) MarshalJSON() ([]byte, error) { + type Properties AWSWAFRegionalXssMatchSet + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWAFRegionalXssMatchSet) UnmarshalJSON(b []byte) error { + type Properties AWSWAFRegionalXssMatchSet + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWAFRegionalXssMatchSet(*res.Properties) + } + + return nil +} + +// GetAllAWSWAFRegionalXssMatchSetResources retrieves all AWSWAFRegionalXssMatchSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSWAFRegionalXssMatchSetResources() map[string]AWSWAFRegionalXssMatchSet { + results := map[string]AWSWAFRegionalXssMatchSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWAFRegionalXssMatchSet: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::XssMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalXssMatchSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWAFRegionalXssMatchSetWithName retrieves all AWSWAFRegionalXssMatchSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWAFRegionalXssMatchSetWithName(name string) (AWSWAFRegionalXssMatchSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWAFRegionalXssMatchSet: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WAFRegional::XssMatchSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWAFRegionalXssMatchSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWAFRegionalXssMatchSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset_fieldtomatch.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset_fieldtomatch.go new file mode 100644 index 0000000000..6e4a0c54af --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset_fieldtomatch.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFRegionalXssMatchSet_FieldToMatch AWS CloudFormation Resource (AWS::WAFRegional::XssMatchSet.FieldToMatch) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-xssmatchset-fieldtomatch.html +type AWSWAFRegionalXssMatchSet_FieldToMatch struct { + + // Data AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-xssmatchset-fieldtomatch.html#cfn-wafregional-xssmatchset-fieldtomatch-data + Data string `json:"Data,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-xssmatchset-fieldtomatch.html#cfn-wafregional-xssmatchset-fieldtomatch-type + Type string `json:"Type,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalXssMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAFRegional::XssMatchSet.FieldToMatch" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalXssMatchSet_FieldToMatch) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset_xssmatchtuple.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset_xssmatchtuple.go new file mode 100644 index 0000000000..784fdb3cf8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset_xssmatchtuple.go @@ -0,0 +1,26 @@ +package cloudformation + +// AWSWAFRegionalXssMatchSet_XssMatchTuple AWS CloudFormation Resource (AWS::WAFRegional::XssMatchSet.XssMatchTuple) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-xssmatchset-xssmatchtuple.html +type AWSWAFRegionalXssMatchSet_XssMatchTuple struct { + + // FieldToMatch AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-xssmatchset-xssmatchtuple.html#cfn-wafregional-xssmatchset-xssmatchtuple-fieldtomatch + FieldToMatch *AWSWAFRegionalXssMatchSet_FieldToMatch `json:"FieldToMatch,omitempty"` + + // TextTransformation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-xssmatchset-xssmatchtuple.html#cfn-wafregional-xssmatchset-xssmatchtuple-texttransformation + TextTransformation string `json:"TextTransformation,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalXssMatchSet_XssMatchTuple) AWSCloudFormationType() string { + return "AWS::WAFRegional::XssMatchSet.XssMatchTuple" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWAFRegionalXssMatchSet_XssMatchTuple) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-workspaces-workspace.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-workspaces-workspace.go new file mode 100644 index 0000000000..cb43641758 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-workspaces-workspace.go @@ -0,0 +1,140 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSWorkSpacesWorkspace AWS CloudFormation Resource (AWS::WorkSpaces::Workspace) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-workspaces-workspace.html +type AWSWorkSpacesWorkspace struct { + + // BundleId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-workspaces-workspace.html#cfn-workspaces-workspace-bundleid + BundleId string `json:"BundleId,omitempty"` + + // DirectoryId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-workspaces-workspace.html#cfn-workspaces-workspace-directoryid + DirectoryId string `json:"DirectoryId,omitempty"` + + // RootVolumeEncryptionEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-workspaces-workspace.html#cfn-workspaces-workspace-rootvolumeencryptionenabled + RootVolumeEncryptionEnabled bool `json:"RootVolumeEncryptionEnabled,omitempty"` + + // UserName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-workspaces-workspace.html#cfn-workspaces-workspace-username + UserName string `json:"UserName,omitempty"` + + // UserVolumeEncryptionEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-workspaces-workspace.html#cfn-workspaces-workspace-uservolumeencryptionenabled + UserVolumeEncryptionEnabled bool `json:"UserVolumeEncryptionEnabled,omitempty"` + + // VolumeEncryptionKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-workspaces-workspace.html#cfn-workspaces-workspace-volumeencryptionkey + VolumeEncryptionKey string `json:"VolumeEncryptionKey,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWorkSpacesWorkspace) AWSCloudFormationType() string { + return "AWS::WorkSpaces::Workspace" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *AWSWorkSpacesWorkspace) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} + +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *AWSWorkSpacesWorkspace) MarshalJSON() ([]byte, error) { + type Properties AWSWorkSpacesWorkspace + return json.Marshal(&struct { + Type string + Properties Properties + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSWorkSpacesWorkspace) UnmarshalJSON(b []byte) error { + type Properties AWSWorkSpacesWorkspace + res := &struct { + Type string + Properties *Properties + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + + // If the resource has no Properties set, it could be nil + if res.Properties != nil { + *r = AWSWorkSpacesWorkspace(*res.Properties) + } + + return nil +} + +// GetAllAWSWorkSpacesWorkspaceResources retrieves all AWSWorkSpacesWorkspace items from an AWS CloudFormation template +func (t *Template) GetAllAWSWorkSpacesWorkspaceResources() map[string]AWSWorkSpacesWorkspace { + results := map[string]AWSWorkSpacesWorkspace{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSWorkSpacesWorkspace: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WorkSpaces::Workspace" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWorkSpacesWorkspace + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSWorkSpacesWorkspaceWithName retrieves all AWSWorkSpacesWorkspace items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSWorkSpacesWorkspaceWithName(name string) (AWSWorkSpacesWorkspace, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSWorkSpacesWorkspace: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "AWS::WorkSpaces::Workspace" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSWorkSpacesWorkspace + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSWorkSpacesWorkspace{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessapi_stringorjson.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessapi_stringorjson.go new file mode 100644 index 0000000000..4ad2d4453d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessapi_stringorjson.go @@ -0,0 +1,55 @@ +package cloudformation + +import ( + "encoding/json" +) + +// AWSServerlessApi_StringOrJson is a helper struct that can hold either a String or Json value +type AWSServerlessApi_StringOrJson struct { + String *string + Json *interface{} +} + +func (r AWSServerlessApi_StringOrJson) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.Json != nil { + return r.Json + } + + return nil + +} + +func (r *AWSServerlessApi_StringOrJson) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessApi_StringOrJson) UnmarshalJSON(b []byte) error { + + // Unmarshal into interface{} to check it's type + var typecheck interface{} + if err := json.Unmarshal(b, &typecheck); err != nil { + return err + } + + switch val := typecheck.(type) { + + case string: + r.String = &val + + case interface{}: + r.Json = &val + + case map[string]interface{}: + + case []interface{}: + + } + + return nil +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessapi_stringors3location.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessapi_stringors3location.go new file mode 100644 index 0000000000..f2b7b9dc51 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessapi_stringors3location.go @@ -0,0 +1,57 @@ +package cloudformation + +import ( + "encoding/json" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessApi_StringOrS3Location is a helper struct that can hold either a String or S3Location value +type AWSServerlessApi_StringOrS3Location struct { + String *string + + S3Location *AWSServerlessApi_S3Location +} + +func (r AWSServerlessApi_StringOrS3Location) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.S3Location != nil { + return r.S3Location + } + + return nil + +} + +func (r *AWSServerlessApi_StringOrS3Location) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessApi_StringOrS3Location) UnmarshalJSON(b []byte) error { + + // Unmarshal into interface{} to check it's type + var typecheck interface{} + if err := json.Unmarshal(b, &typecheck); err != nil { + return err + } + + switch val := typecheck.(type) { + + case string: + r.String = &val + + case map[string]interface{}: + + mapstructure.Decode(val, &r.S3Location) + + case []interface{}: + + } + + return nil +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_s3eventorsnseventorkinesiseventordynamodbeventorapieventorscheduleeventorcloudwatcheventeventoriotruleeventoralexaskillevent.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_s3eventorsnseventorkinesiseventordynamodbeventorapieventorscheduleeventorcloudwatcheventeventoriotruleeventoralexaskillevent.go new file mode 100644 index 0000000000..afa3b8cd5e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_s3eventorsnseventorkinesiseventordynamodbeventorapieventorscheduleeventorcloudwatcheventeventoriotruleeventoralexaskillevent.go @@ -0,0 +1,104 @@ +package cloudformation + +import ( + "encoding/json" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessFunction_S3EventOrSNSEventOrKinesisEventOrDynamoDBEventOrApiEventOrScheduleEventOrCloudWatchEventEventOrIoTRuleEventOrAlexaSkillEvent is a helper struct that can hold either a S3Event, SNSEvent, KinesisEvent, DynamoDBEvent, ApiEvent, ScheduleEvent, CloudWatchEventEvent, IoTRuleEvent, or AlexaSkillEvent value +type AWSServerlessFunction_S3EventOrSNSEventOrKinesisEventOrDynamoDBEventOrApiEventOrScheduleEventOrCloudWatchEventEventOrIoTRuleEventOrAlexaSkillEvent struct { + S3Event *AWSServerlessFunction_S3Event + SNSEvent *AWSServerlessFunction_SNSEvent + KinesisEvent *AWSServerlessFunction_KinesisEvent + DynamoDBEvent *AWSServerlessFunction_DynamoDBEvent + ApiEvent *AWSServerlessFunction_ApiEvent + ScheduleEvent *AWSServerlessFunction_ScheduleEvent + CloudWatchEventEvent *AWSServerlessFunction_CloudWatchEventEvent + IoTRuleEvent *AWSServerlessFunction_IoTRuleEvent + AlexaSkillEvent *AWSServerlessFunction_AlexaSkillEvent +} + +func (r AWSServerlessFunction_S3EventOrSNSEventOrKinesisEventOrDynamoDBEventOrApiEventOrScheduleEventOrCloudWatchEventEventOrIoTRuleEventOrAlexaSkillEvent) value() interface{} { + + if r.S3Event != nil { + return r.S3Event + } + + if r.SNSEvent != nil { + return r.SNSEvent + } + + if r.KinesisEvent != nil { + return r.KinesisEvent + } + + if r.DynamoDBEvent != nil { + return r.DynamoDBEvent + } + + if r.ApiEvent != nil { + return r.ApiEvent + } + + if r.ScheduleEvent != nil { + return r.ScheduleEvent + } + + if r.CloudWatchEventEvent != nil { + return r.CloudWatchEventEvent + } + + if r.IoTRuleEvent != nil { + return r.IoTRuleEvent + } + + if r.AlexaSkillEvent != nil { + return r.AlexaSkillEvent + } + + return nil + +} + +func (r *AWSServerlessFunction_S3EventOrSNSEventOrKinesisEventOrDynamoDBEventOrApiEventOrScheduleEventOrCloudWatchEventEventOrIoTRuleEventOrAlexaSkillEvent) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessFunction_S3EventOrSNSEventOrKinesisEventOrDynamoDBEventOrApiEventOrScheduleEventOrCloudWatchEventEventOrIoTRuleEventOrAlexaSkillEvent) UnmarshalJSON(b []byte) error { + + // Unmarshal into interface{} to check it's type + var typecheck interface{} + if err := json.Unmarshal(b, &typecheck); err != nil { + return err + } + + switch val := typecheck.(type) { + + case map[string]interface{}: + + mapstructure.Decode(val, &r.S3Event) + + mapstructure.Decode(val, &r.SNSEvent) + + mapstructure.Decode(val, &r.KinesisEvent) + + mapstructure.Decode(val, &r.DynamoDBEvent) + + mapstructure.Decode(val, &r.ApiEvent) + + mapstructure.Decode(val, &r.ScheduleEvent) + + mapstructure.Decode(val, &r.CloudWatchEventEvent) + + mapstructure.Decode(val, &r.IoTRuleEvent) + + mapstructure.Decode(val, &r.AlexaSkillEvent) + + case []interface{}: + + } + + return nil +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringoriampolicydocumentorlistofstringorlistofiampolicydocument.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringoriampolicydocumentorlistofstringorlistofiampolicydocument.go new file mode 100644 index 0000000000..28416b5fed --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringoriampolicydocumentorlistofstringorlistofiampolicydocument.go @@ -0,0 +1,76 @@ +package cloudformation + +import ( + "encoding/json" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessFunction_StringOrIAMPolicyDocumentOrListOfStringOrListOfIAMPolicyDocument is a helper struct that can hold either a String, String, IAMPolicyDocument, or IAMPolicyDocument value +type AWSServerlessFunction_StringOrIAMPolicyDocumentOrListOfStringOrListOfIAMPolicyDocument struct { + String *string + + StringArray *[]string + + IAMPolicyDocument *AWSServerlessFunction_IAMPolicyDocument + + IAMPolicyDocumentArray *[]AWSServerlessFunction_IAMPolicyDocument +} + +func (r AWSServerlessFunction_StringOrIAMPolicyDocumentOrListOfStringOrListOfIAMPolicyDocument) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.String != nil { + return r.String + } + + if r.IAMPolicyDocument != nil { + return r.IAMPolicyDocument + } + + if r.IAMPolicyDocument != nil { + return r.IAMPolicyDocument + } + + return nil + +} + +func (r *AWSServerlessFunction_StringOrIAMPolicyDocumentOrListOfStringOrListOfIAMPolicyDocument) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessFunction_StringOrIAMPolicyDocumentOrListOfStringOrListOfIAMPolicyDocument) UnmarshalJSON(b []byte) error { + + // Unmarshal into interface{} to check it's type + var typecheck interface{} + if err := json.Unmarshal(b, &typecheck); err != nil { + return err + } + + switch val := typecheck.(type) { + + case string: + r.String = &val + + case []string: + r.StringArray = &val + + case map[string]interface{}: + + mapstructure.Decode(val, &r.IAMPolicyDocument) + + case []interface{}: + + mapstructure.Decode(val, &r.StringArray) + + mapstructure.Decode(val, &r.IAMPolicyDocumentArray) + + } + + return nil +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringorlistofstring.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringorlistofstring.go new file mode 100644 index 0000000000..41de51ff79 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringorlistofstring.go @@ -0,0 +1,60 @@ +package cloudformation + +import ( + "encoding/json" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessFunction_StringOrListOfString is a helper struct that can hold either a String or String value +type AWSServerlessFunction_StringOrListOfString struct { + String *string + + StringArray *[]string +} + +func (r AWSServerlessFunction_StringOrListOfString) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.String != nil { + return r.String + } + + return nil + +} + +func (r *AWSServerlessFunction_StringOrListOfString) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessFunction_StringOrListOfString) UnmarshalJSON(b []byte) error { + + // Unmarshal into interface{} to check it's type + var typecheck interface{} + if err := json.Unmarshal(b, &typecheck); err != nil { + return err + } + + switch val := typecheck.(type) { + + case string: + r.String = &val + + case []string: + r.StringArray = &val + + case map[string]interface{}: + + case []interface{}: + + mapstructure.Decode(val, &r.StringArray) + + } + + return nil +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringors3location.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringors3location.go new file mode 100644 index 0000000000..c2f28c2fe0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_stringors3location.go @@ -0,0 +1,57 @@ +package cloudformation + +import ( + "encoding/json" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessFunction_StringOrS3Location is a helper struct that can hold either a String or S3Location value +type AWSServerlessFunction_StringOrS3Location struct { + String *string + + S3Location *AWSServerlessFunction_S3Location +} + +func (r AWSServerlessFunction_StringOrS3Location) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.S3Location != nil { + return r.S3Location + } + + return nil + +} + +func (r *AWSServerlessFunction_StringOrS3Location) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessFunction_StringOrS3Location) UnmarshalJSON(b []byte) error { + + // Unmarshal into interface{} to check it's type + var typecheck interface{} + if err := json.Unmarshal(b, &typecheck); err != nil { + return err + } + + switch val := typecheck.(type) { + + case string: + r.String = &val + + case map[string]interface{}: + + mapstructure.Decode(val, &r.S3Location) + + case []interface{}: + + } + + return nil +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/tag.go b/vendor/github.com/awslabs/goformation/cloudformation/tag.go new file mode 100644 index 0000000000..219a4a1446 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/tag.go @@ -0,0 +1,26 @@ +package cloudformation + +// Tag AWS CloudFormation Resource (Tag) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html +type Tag struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html#cfn-resource-tags-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html#cfn-resource-tags-value + Value string `json:"Value,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *Tag) AWSCloudFormationType() string { + return "Tag" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *Tag) AWSCloudFormationSpecificationVersion() string { + return "1.4.2" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/template.go b/vendor/github.com/awslabs/goformation/cloudformation/template.go new file mode 100644 index 0000000000..21e3cc0b88 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/template.go @@ -0,0 +1,44 @@ +package cloudformation + +import ( + "encoding/json" + + "github.com/sanathkr/yaml" +) + +// Template represents an AWS CloudFormation template +// see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html +type Template struct { + AWSTemplateFormatVersion string `json:"AWSTemplateFormatVersion,omitempty"` + Description string `json:"Description,omitempty"` + Metadata map[string]interface{} `json:"Metadata,omitempty"` + Parameters map[string]interface{} `json:"Parameters,omitempty"` + Mappings map[string]interface{} `json:"Mappings,omitempty"` + Conditions map[string]interface{} `json:"Conditions,omitempty"` + Resources map[string]interface{} `json:"Resources,omitempty"` + Outputs map[string]interface{} `json:"Outputs,omitempty"` +} + +// NewTemplate creates a new AWS CloudFormation template struct +func NewTemplate() *Template { + return &Template{ + AWSTemplateFormatVersion: "2010-09-09", + Description: "", + Metadata: map[string]interface{}{}, + Parameters: map[string]interface{}{}, + Mappings: map[string]interface{}{}, + Conditions: map[string]interface{}{}, + Resources: map[string]interface{}{}, + Outputs: map[string]interface{}{}, + } +} + +// JSON converts an AWS CloudFormation template object to JSON +func (t *Template) JSON() ([]byte, error) { + return json.Marshal(t) +} + +// YAML converts an AWS CloudFormation template object to YAML +func (t *Template) YAML() ([]byte, error) { + return yaml.Marshal(t) +} diff --git a/vendor/github.com/awslabs/goformation/generate/templates/polymorphic-property.template b/vendor/github.com/awslabs/goformation/generate/templates/polymorphic-property.template new file mode 100644 index 0000000000..2f2eba17df --- /dev/null +++ b/vendor/github.com/awslabs/goformation/generate/templates/polymorphic-property.template @@ -0,0 +1,97 @@ +package cloudformation + +import ( + "encoding/json" + {{ if (or .Property.Types .Property.ItemTypes .Property.PrimitiveItemTypes)}} + "github.com/mitchellh/mapstructure" + {{end}} +) + +// {{.Name}} is a helper struct that can hold either a {{.TypesJoined}} value +type {{.Name}} struct { + + {{range $type := $.Property.PrimitiveTypes}} + {{$type}} *{{convertToGoType $type}}{{end}} + + {{range $type := $.Property.PrimitiveItemTypes}} + {{$type}}Array *[]{{convertToGoType $type}}{{end}} + + {{range $type := $.Property.Types}} + {{$type}} *{{$.Basename}}_{{$type}}{{end}} + + {{range $type := $.Property.ItemTypes}} + {{$type}}Array *[]{{$.Basename}}_{{$type}}{{end}} +} + +func (r {{.Name}}) value() interface{} { + + {{range $type := $.Property.PrimitiveTypes}} + if r.{{$type}} != nil { + return r.{{$type}} + } + {{end}} + + {{range $type := $.Property.PrimitiveItemTypes}} + if r.{{$type}} != nil { + return r.{{$type}} + } + {{end}} + + {{range $type := $.Property.Types}} + if r.{{$type}} != nil { + return r.{{$type}} + } + {{end}} + + {{range $type := $.Property.ItemTypes}} + if r.{{$type}} != nil { + return r.{{$type}} + } + {{end}} + + return nil + +} + +func (r *{{.Name}}) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *{{.Name}}) UnmarshalJSON(b []byte) error { + + // Unmarshal into interface{} to check it's type + var typecheck interface{} + if err := json.Unmarshal(b, &typecheck); err != nil { + return err + } + + switch val := typecheck.(type) { + + {{range $type := $.Property.PrimitiveTypes}} + case {{convertToGoType $type}}: + r.{{$type}} = &val + {{end}} + + {{range $type := $.Property.PrimitiveItemTypes}} + case []{{convertToGoType $type}}: + r.{{$type}}Array = &val + {{end}} + + case map[string]interface{}: + {{range $type := $.Property.Types}} + mapstructure.Decode(val, &r.{{$type}}) + {{end}} + + case []interface{}: + {{range $type := $.Property.PrimitiveItemTypes}} + mapstructure.Decode(val, &r.{{$type}}Array) + {{end}} + {{range $type := $.Property.ItemTypes}} + mapstructure.Decode(val, &r.{{$type}}Array) + {{end}} + + } + + return nil +} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/generate/templates/resource.template b/vendor/github.com/awslabs/goformation/generate/templates/resource.template new file mode 100644 index 0000000000..b0b2392141 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/generate/templates/resource.template @@ -0,0 +1,113 @@ +package cloudformation + +{{if not .IsCustomProperty}} +import ( + "encoding/json" + "fmt" + "errors" +) +{{end}} +// {{.StructName}} AWS CloudFormation Resource ({{.Name}}) +// See: {{.Resource.Documentation}} +type {{.StructName}} struct { + {{range $name, $property := .Resource.Properties}} + // {{$name}} AWS CloudFormation Property + // Required: {{$property.Required}} + // See: {{$property.Documentation}} + {{$name}} {{if (or ($property.IsPolymorphic) ($property.IsCustomType) )}}*{{end}}{{$property.GoType $.Basename}} `json:"{{$name}},omitempty"` + {{end}} +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *{{.StructName}}) AWSCloudFormationType() string { + return "{{.Name}}" +} + +// AWSCloudFormationSpecificationVersion returns the AWS Specification Version that this resource was generated from +func (r *{{.StructName}}) AWSCloudFormationSpecificationVersion() string { + return "{{.Version}}" +} +{{if not .IsCustomProperty}} +// MarshalJSON is a custom JSON marshalling hook that embeds this object into +// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'. +func (r *{{.StructName}}) MarshalJSON() ([]byte, error) { + type Properties {{.StructName}} + return json.Marshal(&struct{ + Type string + {{if .IsCustomProperty}}Properties{{else}}Properties Properties{{end}} + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(*r), + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *{{.StructName}}) UnmarshalJSON(b []byte) error { + type Properties {{.StructName}} + res := &struct { + Type string + {{if .IsCustomProperty}}Properties{{else}}Properties *Properties{{end}} + }{} + if err := json.Unmarshal(b, &res); err != nil { + fmt.Printf("ERROR: %s\n", err) + return err + } + *r = {{.StructName}}(*res.Properties) + return nil +} + +// GetAll{{.StructName}}Resources retrieves all {{.StructName}} items from an AWS CloudFormation template +func (t *Template) GetAll{{.StructName}}Resources () map[string]{{.StructName}} { + results := map[string]{{.StructName}}{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case {{.StructName}}: + // We found a strongly typed resource of the correct type; use it + results[name] = resource + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "{{.Name}}" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result {{.StructName}} + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// Get{{.StructName}}WithName retrieves all {{.StructName}} items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) Get{{.StructName}}WithName (name string) ({{.StructName}}, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case {{.StructName}}: + // We found a strongly typed resource of the correct type; use it + return resource, nil + case map[string]interface{}: + // We found an untyped resource (likely from JSON) which *might* be + // the correct type, but we need to check it's 'Type' field + if resType, ok := resource["Type"]; ok { + if resType == "{{.Name}}" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result {{.StructName}} + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return {{.StructName}}{}, errors.New("resource not found") +} +{{end}} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/generate/templates/schema-property.template b/vendor/github.com/awslabs/goformation/generate/templates/schema-property.template new file mode 100644 index 0000000000..50569e7e0b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/generate/templates/schema-property.template @@ -0,0 +1,49 @@ +"{{.Name}}": { + + {{if .Property.IsCustomType}} + "$ref": "#/definitions/{{.Parent}}.{{.Property.Type}}" + {{end}} + + {{if .Property.IsPrimitive}} + "type": "{{.Property.GetJSONPrimitiveType}}" + {{end}} + + {{if .Property.IsMap}} + "type": "object", + {{if .Property.IsMapOfPrimitives}} + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "{{.Property.GetJSONPrimitiveType}}" + } + } + {{else}} + "patternProperties": { + "^[a-zA-Z0-9]+$": { + {{ if eq .Property.ItemType "Tag" }} + "$ref": "#/definitions/Tag" + {{else}} + "$ref": "#/definitions/{{.Parent}}.{{.Property.ItemType}}" + {{end}} + } + } + {{end}} + {{end}} + + {{if .Property.IsList}} + "type": "array", + {{if .Property.IsListOfPrimitives}} + "items": { + "type": "{{.Property.GetJSONPrimitiveType}}" + } + {{else}} + "items": { + {{ if eq .Property.ItemType "Tag" }} + "$ref": "#/definitions/Tag" + {{else}} + "$ref": "#/definitions/{{.Parent}}.{{.Property.ItemType}}" + {{end}} + } + {{end}} + {{end}} + +} diff --git a/vendor/github.com/awslabs/goformation/generate/templates/schema-resource.template b/vendor/github.com/awslabs/goformation/generate/templates/schema-resource.template new file mode 100644 index 0000000000..bfe76f308b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/generate/templates/schema-resource.template @@ -0,0 +1,9 @@ +"{{.Name}}": { + "type": "object", + {{if .Resource.Required}}"required": [{{.Resource.Required}}],{{end}} + "properties": { + {{$length := len .Resource.Properties}}{{$pc := counter $length}}{{range $name, $property := .Resource.Properties}} + {{$property.Schema $name $.Name}}{{if call $pc}},{{end}} + {{end}} + } +} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/generate/templates/schema.template b/vendor/github.com/awslabs/goformation/generate/templates/schema.template new file mode 100644 index 0000000000..811b70d0cf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/generate/templates/schema.template @@ -0,0 +1,144 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + + "AWSTemplateFormatVersion": { + "type": "string", + "enum": [ + "2010-09-09" + ] + }, + + "Description": { + "description": "Template description", + "type": "string", + "maxLength": 1024 + }, + + "Parameters": { + "type": "object", + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "$ref": "#/definitions/Parameter" + } + }, + "maxProperties": 50, + "additionalProperties": false + }, + + "Mappings": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object" + } + }, + "additionalProperties": false + }, + + "Conditions": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object" + } + }, + "additionalProperties": false + }, + "Resources": { + "type": "object", + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "anyOf": [ + {{$length := len .Resources}}{{$c := counter $length}}{{range $name, $resources := .Resources}} { "$ref": "#/definitions/{{$name}}" }{{if call $c}}, {{end}} + {{end}} + ] + } + } + } + }, + + "definitions": { + "Parameter": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "enum": [ + "String", + "Number", + "List", + "CommaDelimitedList", + "AWS::EC2::AvailabilityZone::Name", + "AWS::EC2::Image::Id", + "AWS::EC2::Instance::Id", + "AWS::EC2::KeyPair::KeyName", + "AWS::EC2::SecurityGroup::GroupName", + "AWS::EC2::SecurityGroup::Id", + "AWS::EC2::Subnet::Id", + "AWS::EC2::Volume::Id", + "AWS::EC2::VPC::Id", + "AWS::Route53::HostedZone::Id", + "List", + "List", + "List", + "List", + "List", + "List", + "List", + "List", + "List", + "List" + ] + }, + "AllowedPattern": { + "type": "string" + }, + "AllowedValues": { + "type": "array" + }, + "ConstraintDescription": { + "type": "string" + }, + "Default": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "MaxLength": { + "type": "string" + }, + "MaxValue": { + "type": "string" + }, + "MinLength": { + "type": "string" + }, + "MinValue": { + "type": "string" + }, + "NoEcho": { + "type": [ + "string", + "boolean" + ] + } + }, + "additionalProperties": false, + "required": [ + "Type" + ] + }, + + {{range $name, $resource := .Resources}} + {{$resource.Schema $name}}, + {{end}} + + {{$length := len .Properties}}{{$rc := counter $length}}{{range $name, $resource := .Properties}} + {{$resource.Schema $name}}{{if call $rc}},{{end}} + {{end}} + + } +} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/goformation.go b/vendor/github.com/awslabs/goformation/goformation.go index 5690a84734..e5ae2620dd 100644 --- a/vendor/github.com/awslabs/goformation/goformation.go +++ b/vendor/github.com/awslabs/goformation/goformation.go @@ -1,79 +1,65 @@ package goformation import ( - "io" + "encoding/json" "io/ioutil" - "os" - "path/filepath" + "strings" - . "github.com/awslabs/goformation/resources" - "github.com/awslabs/goformation/util" - "github.com/pkg/errors" + "github.com/awslabs/goformation/cloudformation" + "github.com/awslabs/goformation/intrinsics" ) -// Open opens a file given and parses it, returning the result -// In the return objects there's also the logs -func Open(filename string) (Template, map[string][]string, []error) { - util.LogInfo(-1, "GoFormation", "Opening file %s", filename) +//go:generate generate/generate.sh - fp, err := filepath.Abs(filename) +// Open and parse a AWS CloudFormation template from file. +// Works with either JSON or YAML formatted templates. +func Open(filename string) (*cloudformation.Template, error) { + + data, err := ioutil.ReadFile(filename) if err != nil { - return nil, nil, []error{util.ErrFailedToReadTemplate} + return nil, err } - f, err := os.Open(fp) - if err != nil { - return nil, nil, []error{util.ErrFailedToReadTemplate} + if strings.HasSuffix(filename, ".yaml") || strings.HasSuffix(filename, ".yml") { + return ParseYAML(data) } - return read(f) + return ParseJSON(data) } -func read(input io.Reader) (Template, map[string][]string, []error) { - // Read data - data, err := ioutil.ReadAll(input) +// ParseYAML an AWS CloudFormation template (expects a []byte of valid YAML) +func ParseYAML(data []byte) (*cloudformation.Template, error) { + // Process all AWS CloudFormation intrinsic functions (e.g. Fn::Join) + intrinsified, err := intrinsics.ProcessYAML(data, nil) if err != nil { - return nil, nil, []error{util.ErrFailedToReadTemplate} + return nil, err } - return Parse(data) + return unmarshal(intrinsified) + } -// Parse receives the contents of a template and parses it. -// After parsing, it returns you the parsed template, and the log for the operation. -func Parse(input []byte) (Template, map[string][]string, []error) { - util.LogInfo(-1, "GoFormation", "Parsing process started") - - util.LogInfo(-1, "GoFormation", "Unmarshalling template") - unmarshalledTemplate, unmarshallingError := unmarshal(input) - if unmarshallingError != nil { - util.LogError(-1, "GoFormation", "Failed to unmarshal the template") - errorMessage := util.GetUnmarshallingErrorMessage(unmarshallingError) - return nil, util.GetLogs(), []error{errors.New(errorMessage)} +// ParseJSON an AWS CloudFormation template (expects a []byte of valid JSON) +func ParseJSON(data []byte) (*cloudformation.Template, error) { + + // Process all AWS CloudFormation intrinsic functions (e.g. Fn::Join) + intrinsified, err := intrinsics.ProcessJSON(data, nil) + if err != nil { + return nil, err } - util.LogInfo(-1, "GoFormation", "Template unmarshalled successfully") - util.LogInfo(-1, "GoFormation", "Scaffolding the template") - scaffoldedTemplate, scaffoldingErrors := scaffold(unmarshalledTemplate) - if scaffoldingErrors != nil && len(scaffoldingErrors) > 0 { + return unmarshal(intrinsified) + +} - parsedScaffoldingErrors := make([]error, len(scaffoldingErrors)) - for i, scaffoldingError := range scaffoldingErrors { - errorMessage := util.GetFinalErrorMessage(scaffoldingError) - parsedError := errors.New(errorMessage) - parsedScaffoldingErrors[i] = parsedError - } +func unmarshal(data []byte) (*cloudformation.Template, error) { - util.LogError(-1, "GoFormation", "Failed to scaffold the template due to an error") - return nil, util.GetLogs(), parsedScaffoldingErrors + template := &cloudformation.Template{} + if err := json.Unmarshal(data, template); err != nil { + return nil, err } - processedTemplate, postProcessingError := postProcess(scaffoldedTemplate) - if postProcessingError != nil { - util.LogError(-1, "GoFormation", "Failed to process template") - return nil, util.GetLogs(), []error{postProcessingError} - } + return template, nil - return processedTemplate, util.GetLogs(), nil } diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnbase64.go b/vendor/github.com/awslabs/goformation/intrinsics/fnbase64.go new file mode 100644 index 0000000000..e24ecc2417 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnbase64.go @@ -0,0 +1,18 @@ +package intrinsics + +import "encoding/base64" + +// FnBase64 resolves the 'Fn::Base64' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-base64.htmlpackage intrinsics +func FnBase64(name string, input interface{}, template interface{}) interface{} { + + // { "Fn::Base64" : valueToEncode } + + // Check the input is a string + if src, ok := input.(string); ok { + return base64.StdEncoding.EncodeToString([]byte(src)) + } + + return nil + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnfindinmap.go b/vendor/github.com/awslabs/goformation/intrinsics/fnfindinmap.go new file mode 100644 index 0000000000..29f98a9f19 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnfindinmap.go @@ -0,0 +1,55 @@ +package intrinsics + +// FnFindInMap resolves the 'Fn::FindInMap' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-findinmap.html +func FnFindInMap(name string, input interface{}, template interface{}) interface{} { + + // { "Fn::FindInMap" : [ "MapName", "TopLevelKey", "SecondLevelKey"] } + + // "Mappings" : { + // "RegionMap" : { + // "us-east-1" : { "32" : "ami-6411e20d", "64" : "ami-7a11e213" }, + // "us-west-1" : { "32" : "ami-c9c7978c", "64" : "ami-cfc7978a" }, + // "eu-west-1" : { "32" : "ami-37c2f643", "64" : "ami-31c2f645" }, + // "ap-southeast-1" : { "32" : "ami-66f28c34", "64" : "ami-60f28c32" }, + // "ap-northeast-1" : { "32" : "ami-9c03a89d", "64" : "ami-a003a8a1" } + // } + // } + + // Holy nesting batman! I'm sure there's a better way to do this... :) + + // Check that the input is an array + if arr, ok := input.([]interface{}); ok { + // The first element should be the map name + if mapname, ok := arr[0].(string); ok { + // The second element should be the first level map key + if key1, ok := arr[1].(string); ok { + // The third element should be the second level map key + if key2, ok := arr[2].(string); ok { + // Check the map exists in the CloudFormation template + if tmpl, ok := template.(map[string]interface{}); ok { + if mappings, ok := tmpl["Mappings"]; ok { + if mapmap, ok := mappings.(map[string]interface{}); ok { + if found, ok := mapmap[mapname]; ok { + if foundmap, ok := found.(map[string]interface{}); ok { + // Ok, we've got the map, check the first key exists + if foundkey1, ok := foundmap[key1]; ok { + if foundkey1map, ok := foundkey1.(map[string]interface{}); ok { + if foundkey2, ok := foundkey1map[key2]; ok { + return foundkey2 + } + } + } + } + } + } + } + } + } + } + } + } + + return nil + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fngetatt.go b/vendor/github.com/awslabs/goformation/intrinsics/fngetatt.go new file mode 100644 index 0000000000..d7f64e00e3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fngetatt.go @@ -0,0 +1,9 @@ +package intrinsics + +// FnGetAtt is not implemented, and always returns nil. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html +func FnGetAtt(name string, input interface{}, template interface{}) interface{} { + + // { "Fn::GetAtt" : [ "logicalNameOfResource", "attributeName" ] } + return nil +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnjoin.go b/vendor/github.com/awslabs/goformation/intrinsics/fnjoin.go new file mode 100644 index 0000000000..a063908301 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnjoin.go @@ -0,0 +1,20 @@ +package intrinsics + +// FnJoin resolves the 'Fn::Join' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-join.html +func FnJoin(name string, input interface{}, template interface{}) interface{} { + + result := "" + + // Check the input is an array + if arr, ok := input.([]interface{}); ok { + for _, value := range arr { + if str, ok := value.(string); ok { + result += str + } + } + } + + return result + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnselect.go b/vendor/github.com/awslabs/goformation/intrinsics/fnselect.go new file mode 100644 index 0000000000..e5ef757990 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnselect.go @@ -0,0 +1,26 @@ +package intrinsics + +// FnSelect resolves the 'Fn::Select' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-select.html +func FnSelect(name string, input interface{}, template interface{}) interface{} { + + // { "Fn::Select" : [ index, listOfObjects ] } + + // Check that the input is an array + if arr, ok := input.([]interface{}); ok { + // The first element should be the index + if index64, ok := arr[0].(float64); ok { + index := int(index64) + // The second element is the array of objects to search + if objects, ok := arr[1].([]interface{}); ok { + // Check the requested element is in bounds + if index < len(objects) { + return objects[index] + } + } + } + } + + return nil + +} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnsplit.go b/vendor/github.com/awslabs/goformation/intrinsics/fnsplit.go new file mode 100644 index 0000000000..64699f8a2c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnsplit.go @@ -0,0 +1,24 @@ +package intrinsics + +import "strings" + +// FnSplit resolves the 'Fn::Split' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-split.html +func FnSplit(name string, input interface{}, template interface{}) interface{} { + + // { "Fn::Split" : [ "delimiter", "source string" ] } + + // Check that the input is an array + if arr, ok := input.([]interface{}); ok { + // The first element should be a string (the delimiter) + if delim, ok := arr[0].(string); ok { + // The second element should be a string (the content to join) + if str, ok := arr[1].(string); ok { + return strings.Split(str, delim) + } + } + } + + return []string{} + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnsub.go b/vendor/github.com/awslabs/goformation/intrinsics/fnsub.go new file mode 100644 index 0000000000..70404eb8b3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnsub.go @@ -0,0 +1,66 @@ +package intrinsics + +import ( + "regexp" + "strings" +) + +// FnSub resolves the 'Fn::Sub' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html +func FnSub(name string, input interface{}, template interface{}) interface{} { + + // Input can either be a string for this type of Fn::Sub call: + // { "Fn::Sub": "some-string-with-a-${variable}" } + + // or it will be an array of length two for named replacements + // { "Fn::Sub": [ "some ${replaced}", { "replaced": "value" } ] } + + switch val := input.(type) { + + case []interface{}: + // Replace each of the variables in element 0 with the items in element 1 + if src, ok := val[0].(string); ok { + // The seconds element is a map of variables to replace + if replacements, ok := val[1].(map[string]interface{}); ok { + // Loop through the replacements + for key, replacement := range replacements { + // Check the replacement is a string + if value, ok := replacement.(string); ok { + src = strings.Replace(src, "${"+key+"}", value, -1) + } + } + return src + } + } + + case string: + // Look up references for each of the variables + regex := regexp.MustCompile(`\$\{([\.0-9A-Za-z]+)\}`) + variables := regex.FindAllStringSubmatch(val, -1) + for _, variable := range variables { + + var resolved interface{} + if strings.Contains(variable[1], ".") { + // If the variable name has a . in it, use Fn::GetAtt to resolve it + resolved = FnGetAtt("Fn::GetAtt", strings.Split(variable[1], "."), template) + } else { + // The variable name doesn't have a . in it, so use Ref + resolved = Ref("Ref", variable[1], template) + } + + if resolved != nil { + if replacement, ok := resolved.(string); ok { + val = strings.Replace(val, variable[0], replacement, -1) + } + } else { + // The reference couldn't be resolved, so just strip the variable + val = strings.Replace(val, variable[0], "", -1) + } + + } + return val + } + + return nil + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/intrinsics.go b/vendor/github.com/awslabs/goformation/intrinsics/intrinsics.go new file mode 100644 index 0000000000..de5dab958b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/intrinsics.go @@ -0,0 +1,161 @@ +package intrinsics + +import ( + "encoding/json" + "fmt" + + yamlwrapper "github.com/sanathkr/yaml" +) + +// IntrinsicHandler is a function that applies an intrinsic function and returns +// the response that should be placed in it's place. An intrinsic handler function +// is passed the name of the intrinsic function (e.g. Fn::Join), and the object +// to apply it to (as an interface{}), and should return the resolved object (as an interface{}). +type IntrinsicHandler func(string, interface{}, interface{}) interface{} + +// IntrinsicFunctionHandlers is a map of all the possible AWS CloudFormation intrinsic +// functions, and a handler function that is invoked to resolve. +var defaultIntrinsicHandlers = map[string]IntrinsicHandler{ + "Fn::Base64": FnBase64, + "Fn::And": nonResolvingHandler, + "Fn::Equals": nonResolvingHandler, + "Fn::If": nonResolvingHandler, + "Fn::Not": nonResolvingHandler, + "Fn::Or": nonResolvingHandler, + "Fn::FindInMap": FnFindInMap, + "Fn::GetAtt": nonResolvingHandler, + "Fn::GetAZs": nonResolvingHandler, + "Fn::ImportValue": nonResolvingHandler, + "Fn::Join": FnJoin, + "Fn::Select": FnSelect, + "Fn::Split": FnSplit, + "Fn::Sub": FnSub, + "Ref": Ref, +} + +// ProcessorOptions allows customisation of the intrinsic function processor behaviour. +// Initially, this only allows overriding of the handlers for each intrinsic function type. +type ProcessorOptions struct { + IntrinsicHandlerOverrides map[string]IntrinsicHandler +} + +// nonResolvingHandler is a simple example of an intrinsic function handler function +// that refuses to resolve any intrinsic functions, and just returns a basic string. +func nonResolvingHandler(name string, input interface{}, template interface{}) interface{} { + return nil +} + +// ProcessYAML recursively searches through a byte array of JSON data for all +// AWS CloudFormation intrinsic functions, resolves them, and then returns +// the resulting interface{} object. +func ProcessYAML(input []byte, options *ProcessorOptions) ([]byte, error) { + + // Convert short form intrinsic functions (e.g. !Sub) to long form + registerTagMarshallers() + + data, err := yamlwrapper.YAMLToJSON(input) + if err != nil { + return nil, fmt.Errorf("invalid YAML template: %s", err) + } + + return ProcessJSON(data, options) + +} + +// ProcessJSON recursively searches through a byte array of JSON data for all +// AWS CloudFormation intrinsic functions, resolves them, and then returns +// the resulting interface{} object. +func ProcessJSON(input []byte, options *ProcessorOptions) ([]byte, error) { + + // First, unmarshal the JSON to a generic interface{} type + var unmarshalled interface{} + if err := json.Unmarshal(input, &unmarshalled); err != nil { + return nil, fmt.Errorf("invalid JSON: %s", err) + } + + // Process all of the intrinsic functions + processed := search(unmarshalled, unmarshalled, options) + + // And return the result back as a []byte of JSON + result, err := json.MarshalIndent(processed, "", " ") + if err != nil { + return nil, fmt.Errorf("invalid JSON: %s", err) + } + + return result, nil + +} + +// Search is a recursive function, that will search through an interface{} looking for +// an intrinsic function. If it finds one, it calls the provided handler function, passing +// it the type of intrinsic function (e.g. 'Fn::Join'), and the contents. The intrinsic +// handler is expected to return the value that is supposed to be there. +func search(input interface{}, template interface{}, options *ProcessorOptions) interface{} { + + switch value := input.(type) { + + case map[string]interface{}: + + // We've found an object in the JSON, it might be an intrinsic, it might not. + // To check, we need to see if it contains a specific key that matches the name + // of an intrinsic function. As golang maps do not guarentee ordering, we need + // to check every key, not just the first. + processed := map[string]interface{}{} + for key, val := range value { + + // See if we have an intrinsic handler function for this object key provided in the + if h, ok := handler(key, options); ok { + // This is an intrinsic function, so replace the intrinsic function object + // with the result of calling the intrinsic function handler for this type + return h(key, search(val, template, options), template) + } + + // This is not an intrinsic function, recurse through it normally + processed[key] = search(val, template, options) + + } + return processed + + case []interface{}: + + // We found an array in the JSON - recurse through it's elements looking for intrinsic functions + processed := []interface{}{} + for _, val := range value { + processed = append(processed, search(val, template, options)) + } + return processed + + case nil: + return value + case bool: + return value + case float64: + return value + case string: + return value + default: + return nil + + } + +} + +// handler looks up the correct intrinsic function handler for an object key, if there is one. +// If not, it returns nil, false. +func handler(name string, options *ProcessorOptions) (IntrinsicHandler, bool) { + + // Check if we have a handler for this intrinsic type in the instrinsic handler + // overrides in the options provided to Process() + if options != nil { + if h, ok := options.IntrinsicHandlerOverrides[name]; ok { + return h, true + } + } + + if h, ok := defaultIntrinsicHandlers[name]; ok { + return h, true + } + + return nil, false + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/ref.go b/vendor/github.com/awslabs/goformation/intrinsics/ref.go new file mode 100644 index 0000000000..6310efd99d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/ref.go @@ -0,0 +1,58 @@ +package intrinsics + +// Ref resolves the 'Ref' AWS CloudFormation intrinsic function. +// Currently, this only resolves against CloudFormation Parameter default values +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html +func Ref(name string, input interface{}, template interface{}) interface{} { + + // Dang son, this has got more nest than a bald eagle + // Check the input is a string + if name, ok := input.(string); ok { + + switch name { + + case "AWS::AccountId": + return "123456789012" + case "AWS::NotificationARNs": // + return []string{"arn:aws:sns:us-east-1:123456789012:MyTopic"} + case "AWS::NoValue": + return nil + case "AWS::Region": + return "us-east-1" + case "AWS::StackId": + return "arn:aws:cloudformation:us-east-1:123456789012:stack/MyStack/1c2fa620-982a-11e3-aff7-50e2416294e0" + case "AWS::StackName": + return "goformation-stack" + + default: + + // This isn't a pseudo 'Ref' paramater, so we need to look inside the CloudFormation template + // to see if we can resolve the reference. This implementation just looks at the Parameters section + // to see if there is a parameter matching the name, and if so, return the default value. + + // Check the template is a map + if template, ok := template.(map[string]interface{}); ok { + // Check there is a parameters section + if uparameters, ok := template["Parameters"]; ok { + // Check the parameters section is a map + if parameters, ok := uparameters.(map[string]interface{}); ok { + // Check there is a parameter with the same name as the Ref + if uparameter, ok := parameters[name]; ok { + // Check the parameter is a map + if parameter, ok := uparameter.(map[string]interface{}); ok { + // Check the parameter has a default + if def, ok := parameter["Default"]; ok { + return def + } + } + } + } + } + } + } + + } + + return nil + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/tags.go b/vendor/github.com/awslabs/goformation/intrinsics/tags.go new file mode 100644 index 0000000000..e153b7aca8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/tags.go @@ -0,0 +1,45 @@ +package intrinsics + +import ( + "reflect" + + yaml "github.com/sanathkr/go-yaml" +) + +var allTags = []string{"Ref", "GetAtt", "Base64", "FindInMap", "GetAZs", + "ImportValue", "Join", "Select", "Split", "Sub", +} + +type tagUnmarshalerType struct { +} + +func (t *tagUnmarshalerType) UnmarshalYAMLTag(tag string, fieldValue reflect.Value) reflect.Value { + + prefix := "Fn::" + if tag == "Ref" || tag == "Condition" { + prefix = "" + } + + tag = prefix + tag + + output := reflect.ValueOf(make(map[string]interface{})) + key := reflect.ValueOf(tag) + + output.SetMapIndex(key, fieldValue) + + return output +} + +var tagUnmarshaller = &tagUnmarshalerType{} + +func registerTagMarshallers() { + for _, tag := range allTags { + yaml.RegisterTagUnmarshaler("!"+tag, tagUnmarshaller) + } +} + +func unregisterTagMarshallers() { + for _, tag := range allTags { + yaml.RegisterTagUnmarshaler("!"+tag, tagUnmarshaller) + } +} diff --git a/vendor/github.com/awslabs/goformation/post-process.go b/vendor/github.com/awslabs/goformation/post-process.go deleted file mode 100644 index 998808ffe4..0000000000 --- a/vendor/github.com/awslabs/goformation/post-process.go +++ /dev/null @@ -1,657 +0,0 @@ -package goformation - -import ( - "regexp" - "strings" - - . "github.com/awslabs/goformation/resources" - "github.com/awslabs/goformation/util" -) - -var globalValues = map[string]string{ - "AWS::Region": "xx-mylaptop-1", - "AWS::AccountId": "1234567890", - "AWS::NotificationARNs": "", - "AWS::NoValue": "", - "AWS::StackId": "arn:aws:cloudformation:us-west-2:123456789012:stack/teststack/51af3dc0-da77-11e4-872e-1234567db123", - "AWS::StackName": "My local stack", -} - -var fnRegex = `Fn::(Base64|FindInMap|GetAtt|GetAZs|ImportValue|Join|Select|Split|Sub|Ref)` - -// PostProcess gets a template and a set of parsed resources, and resolves its references -func postProcess(input Template) (Template, error) { - util.LogDebug(-1, "PostProcessing", "Started post-processing template") - - resultTemplate := processedFromScaffolded(input) - util.LogDebug(-1, "PostProcessing", "Iterating over resources") - processedResources := make(map[string]Resource) - allResources := resultTemplate.Resources() - factory := GetResourceFactory() - for name, res := range allResources { - util.LogDebug(-1, "PostProcessing", "Processing resource %s", name) - resourceType := res.Type() - resourceDefinition := factory.GetResourceByType(resourceType) - if resourceDefinition == nil { - util.LogWarning(-1, "Post Processing", "Ignoring resource type %s as it's not supported", resourceType) - continue - } - - util.LogDebug(-1, "PostProcessing", "Processing intrinsic functions") - error := resolveIntrinsicFunctions(res, allResources) - if error != nil { - return nil, error - } - - resourceClass, error := resourceDefinition.ClassConstructor(res) - if error != nil { - return nil, error - } - processedResources[name] = resourceClass - } - - resultTemplate._resources = processedResources - - return resultTemplate, nil -} - -func processedFromScaffolded(input Template) *processedTemplate { - resultTemplate := &processedTemplate{ - _version: input.Version(), - _transform: input.Transform(), - _parameters: input.Parameters(), - _resources: make(map[string]Resource), - _outputs: input.Outputs(), - } - - for key, res := range input.Resources() { - procResource := &processedResource{ - _properties: make(map[string]Property), - _type: res.Type(), - } - - for p, prop := range res.Properties() { - if prop == nil { - continue - } - - procResource._properties[p] = &processedProperty{ - _original: prop.Original(), - _value: nil, - } - } - - resultTemplate._resources[key] = procResource - } - - return resultTemplate -} - -type processedTemplate struct { - _version string - _transform []string - _parameters map[string]Parameter - _resources map[string]Resource - _outputs map[string]Output -} - -func (t *processedTemplate) Version() string { - return t._version -} -func (t *processedTemplate) Transform() []string { - return t._transform -} -func (t *processedTemplate) Parameters() map[string]Parameter { - return t._parameters -} -func (t *processedTemplate) Resources() map[string]Resource { - return t._resources -} -func (t *processedTemplate) Outputs() map[string]Output { - return t._outputs -} - -func (t *processedTemplate) GetResourcesByType(resourceType string) map[string]Resource { - matchingResources := make(map[string]Resource) - for key, res := range t._resources { - if res.Type() == resourceType { - matchingResources[key] = res - } - } - return matchingResources -} - -type processedResource struct { - _type string - _properties map[string]Property - _lineNumber int -} - -func (r *processedResource) Type() string { - return r._type -} - -func (r *processedResource) Properties() map[string]Property { - props := make(map[string]Property) - for key, value := range r._properties { - setPropertyKey(props, key, value) - } - return props -} - -func (r *processedResource) ReturnValues() map[string]string { - return nil -} - -type processedProperty struct { - _original interface{} - _value interface{} - lineNumber int -} - -func (p *processedProperty) Value() interface{} { - return p._value -} -func (p *processedProperty) Original() interface{} { - return p._original -} -func (p *processedProperty) HasFn() bool { - return false -} - -func resolveIntrinsicFunctions(res Resource, resources map[string]Resource) error { - util.LogDebug(-1, "PostProcessing", "Started intrinsic function resolution") - properties := res.Properties() - parsedProperties := lookupObject(properties, resources) - parsedResource := res.(*processedResource) - parsedResource._properties = parsedProperties - util.LogDebug(-1, "PostProcessing", "Intrinsic function resolution finished") - - return nil -} - -func resolveValue(input string, resources map[string]Resource) string { - var globalValueRegex = `AWS::` - globalMatch, error := regexp.Match(globalValueRegex, []byte(input)) - if error != nil { - - } else if globalMatch { - output, outputSet := globalValues[input] - if !outputSet { - util.LogError(-1, "PostProcessing", "The value %s does not exist", input) - } else { - return output - } - } else { - parsedInput := strings.Split(input, `.`) - matchingResource, resourceExists := resources[parsedInput[0]] - if !resourceExists { - return "" - } - - var returnParam string - // Is it a Ref or an Att? - if len(parsedInput) == 1 { - returnParam = "Ref" - } else { - returnParam = parsedInput[1] - } - - returnValues := matchingResource.ReturnValues() - output, outputOk := returnValues[returnParam] - if !outputOk { - util.LogError(-1, "PostProcessing", "Output %s does not exist for resource %s", returnParam, parsedInput[0]) - return "" - } - - return output - } - - return "" -} - -func fnBase64(value string, resources map[string]Resource) string { - return "" -} - -func fnFindInMap(value string, resources map[string]Resource) string { - return "" -} - -func fnGetAZs(value string, resources map[string]Resource) string { - return "" -} - -func fnImportValue(value string, resources map[string]Resource) string { - return "" -} - -func fnJoin(value []interface{}, resources map[string]Resource) string { - valueLen := len(value) - if valueLen != 2 { - util.LogError(-1, "PostProcessing", "Fn::Join array needs two elements: delimiter and list") - } else { - delimiter, delimiterStringOk := value[0].(string) - listInterface, listArrayOk := value[1].([]interface{}) - if !delimiterStringOk || !listArrayOk { - util.LogError(-1, "PostProcessing", "The delimiter or the list of values provided for Fn::Join is incorrect") - } else { - list := make([]string, len(listInterface)) - for _, listValue := range listInterface { - valueString, valueStringOk := listValue.(string) - if !valueStringOk { - util.LogError(-1, "PostProcessing", "One of the values of the Fn::Join list is not a String") - } else { - list = append(list, valueString) - } - } - - result := strings.Join(list, delimiter) - return result - } - } - - return "" -} - -func fnSelect(value string, resources map[string]Resource) string { - return "" -} - -func fnSplit(value string, resources map[string]Resource) string { - return "" -} - -func fnGetAtt(value string, resources map[string]Resource) string { - output := resolveValue(value, resources) - return output -} - -func fnSub(value interface{}, resources map[string]Resource, inlineParameters map[string]interface{}) string { - - var substitutionString string - var resolutionVariables map[string]interface{} - - // Sub 1: Inline string - if valueString, ok := value.(string); ok { - substitutionString = valueString - } else if valueArray, ok := value.([]interface{}); ok { - substitutionString = valueArray[0].(string) - resolutionVariables = valueArray[1].(map[string]interface{}) - } else { - util.LogError(-1, "PostProcessing", "Source object for Sub is of an unsopported type") - return "" - } - - // First resolve the resolution variables - var resolvedVariables = map[string]interface{}{} - for key, variable := range resolutionVariables { - realValue := resolveValue(variable.(string), resources) - if realValue != "" { - resolvedVariables[key] = realValue - } else { - resolvedVariables[key] = variable - } - } - - // Identify variables in substitution text - var varInTextStr = `\$\{([a-zA-Z0-9_:]+)\}` - varInTextRegex := regexp.MustCompile(varInTextStr) - occurrences := varInTextRegex.FindAllString(substitutionString, -1) - for _, occurrence := range occurrences { - occurrenceMatches := varInTextRegex.FindStringSubmatch(occurrence) - parameterName := occurrenceMatches[1] - - var keyResolved = false - var value string - if inlineParameters != nil { - inlineParameter, inlineParameterExists := inlineParameters[parameterName] - if inlineParameterExists { - var valueString bool - value, valueString = inlineParameter.(string) - if !valueString { - util.LogError(-1, "PostProcessing", "Value from inline resolution must be a String") - return "" - } - - keyResolved = true - } - } - - if !keyResolved { - value = resolveValue(parameterName, resources) - if value == "" { - util.LogWarning(-1, "PostProcessing", "The value %s does not resolve.", parameterName) - } - } - - substitutionString = strings.Replace(substitutionString, `${`+parameterName+`}`, value, 1) - } - - return substitutionString -} - -func complexFnSub(valueArray []interface{}, resources map[string]Resource) string { - valueLen := len(valueArray) - if valueLen != 2 { - util.LogError(-1, "PostProcessing", "Wrong number of attributes %d for Fn::Sub %s", valueLen, valueArray) - } else { - valueSentence, valueSentenceString := valueArray[0].(string) - valueAttributes, valueAttributesMap := valueArray[1].(map[interface{}]interface{}) - if !valueSentenceString { - util.LogError(-1, "PostProcessing", "First parameter for Fn::Sub must be a String.") - } else { - if !valueAttributesMap { - util.LogError(-1, "PostProcessing", "The second parameter for Fn::Sub must be a map, %s:%s", valueSentence, valueArray[1]) - } else { - // TODO Convert attributes to properties - attributesProps := make(map[string]Property) - for attrKey, attrValue := range valueAttributes { - attributesProps[attrKey.(string)] = &processedProperty{ - _value: attrValue, - } - } - lookupObject(attributesProps, resources) - - mapString := make(map[string]interface{}) - for mapKey, mapValue := range valueAttributes { - mapKeyString, mapKeyStringOk := mapKey.(string) - if !mapKeyStringOk { - util.LogError(-1, "PostProcessing", "One of the Fn::Sub attribute keys is not a string, %s", mapKey) - } else { - mapString[mapKeyString] = mapValue - } - } - - // Now let's resolve the content - return fnSub(valueSentence, resources, mapString) - } - } - } - - return "" -} - -func fnRef(value string, resources map[string]Resource) string { - realValue := resolveValue(value, resources) - if realValue == "" { - util.LogError(-1, "PostProcessing", "Ref not resolving") - } - - return realValue -} - -func resolveInline(fn string, value interface{}, resources map[string]Resource) (string, error) { - var realValue string - var error error - - valueArray, valueArrayOk := value.([]interface{}) - if valueArrayOk { - resolvedValue := lookupArray(valueArray, resources) - if _, resolvedValueArrayOk := resolvedValue.([]interface{}); !resolvedValueArrayOk { - value = resolvedValue.(string) - } - } - - switch fn { - case "Base64": - fallthrough - case "FindInMap": - fallthrough - case "GetAZs": - fallthrough - case "ImportValue": - fallthrough - case "Select": - fallthrough - case "Split": - realValue = "Intrinsic function " + fn + "" - case "Join": - valueArray, arrayOk := value.([]interface{}) - if !arrayOk { - util.LogError(-1, "PostProcessing", "Fn::Join function received wrong input `%s`", value) - } else { - realValue = fnJoin(valueArray, resources) - } - case "GetAtt": - realValue = fnGetAtt(value.(string), resources) - case "Sub": - subAttrs, inlineComplex := value.([]interface{}) - if inlineComplex { - subString := subAttrs[0] - functionAttributes := subAttrs[1] - // Create complexSub data - subData := []interface{}{ - subString, - functionAttributes, - } - - realValue = complexFnSub(subData, resources) - } else { - realValue = fnSub(value, resources, nil) - } - case "Ref": - realValue = fnRef(value.(string), resources) - } - - return realValue, error -} - -func lookupArray(source []interface{}, resources map[string]Resource) interface{} { - // First, look through the array looking for inner intrinsic - for key, value := range source { - valueArray, valueArrayOk := value.([]interface{}) - if valueArrayOk { - resolvedValue := lookupArray(valueArray, resources) - source[key] = resolvedValue - } - } - - // Now look if there's an intrinsic in this array - if len(source) > 0 { - var objectKey, objectKeyString = source[0].(string) - if objectKeyString { - // Find inline Intrinsic Functions: - hasInlineFn, error := regexp.Match(fnRegex, []byte(objectKey)) - if error != nil { - util.LogError(-1, "PostProcessing", "%s", error.Error()) - } else if hasInlineFn { - regex := regexp.MustCompile(fnRegex) - occurrence := regex.FindString(objectKey) - - fnMatches := regex.FindStringSubmatch(occurrence) - fn := fnMatches[1] - fnValue := source[1] - - // Verify if value contains inner inline intrinsic - fnValueArray, fnValueArrayOk := fnValue.([]interface{}) - if fnValueArrayOk { - fnValue = lookupArray(fnValueArray, resources) - } - - var sourceValue interface{} - if len(source) > 2 { - valueArray := make([]interface{}, 2) - - fnAttrs := source[2] - valueArray = append(valueArray, fnValue) - valueArray = append(valueArray, fnAttrs) - - sourceValue = valueArray - } else { - sourceValue = fnValue - } - - resolvedValue, resolutionError := resolveInline(fn, sourceValue, resources) - if resolutionError != nil { - util.LogError(-1, "PostProcessing", "Resolution error: %s", resolutionError.Error()) - } else { - return resolvedValue - } - } else { - return source - } - } - } - - return nil -} - -func lookupObject(source map[string]Property, resources map[string]Resource) map[string]Property { - util.LogDebug(-1, "PostProcessing", "Looking up properties") - - resultProperties := make(map[string]Property) - for key, prop := range source { - util.LogDebug(-1, "PostProcessing", "Looking through key %s", key) - value := prop.Original() - - realValue := recursiveObjectLookup(key, value, resources) - resultProperties[key] = realValue - } - - return resultProperties -} - -func recursiveObjectLookup(key string, value interface{}, resources map[string]Resource) *processedProperty { - realValue := &processedProperty{ - _original: value, - _value: value, - } - - // Is it a map? - if obj, isObj := value.(map[string]Property); isObj { - util.LogDebug(-1, "PostProcessing", "Complex object found. Iterating...") - returnValue := lookupObject(obj, resources) - if returnValue != nil { - realValue._value = returnValue - } - } - - if obj, isObj := value.(map[interface{}]interface{}); isObj { - util.LogDebug(-1, "PostProcessing", "Complex object found. Iterating...") - objProps := make(map[string]Property) - for keyObj, valueObj := range obj { - if valueProp, valuePropOk := valueObj.(Property); valuePropOk { - valuePropValue := valueProp.Value() - if valuePropValueProp, valuePropValuePropOk := valuePropValue.(Property); valuePropValuePropOk { - objProps[keyObj.(string)] = valuePropValueProp - } else { - objProps[keyObj.(string)] = valueProp - } - } else { - resolvedValue := detectIntrinsicFunctionsInObject(keyObj.(string), valueObj, resources) - var valueToAssign interface{} - if resolvedValue == nil { - // Nothing to do if value is null, resolution haven't been made - valueToAssign = value - } else if resolvedValueProp, resolvedValuePropOk := resolvedValue.(*processedProperty); resolvedValuePropOk { - // Returned value is a property, so get the value. - valueToAssign = resolvedValueProp._value - } else { - valueToAssign = resolvedValue - } - - obj[keyObj] = valueToAssign - } - } - - realValue._value = obj - - if len(objProps) > 0 { - returnValue := lookupObject(objProps, resources) - if returnValue != nil { - realValue._value = returnValue - } - } - } - - // Look for functions in the value - if valueArray, isArray := value.([]interface{}); isArray { - util.LogDebug(-1, "PostProcessing", "Array found, iterating") - resolvedValue := lookupArray(valueArray, resources) - if valueStr, valueStrOk := resolvedValue.(string); valueStrOk { - realValue._value = valueStr - } - } - - return realValue -} - -func detectIntrinsicFunctionsInObject(key string, value interface{}, resources map[string]Resource) interface{} { - - keymatch, error := regexp.Match(fnRegex, []byte(key)) - if error != nil { - util.LogError(-1, "PostProcessing", "%s", error) - } else if keymatch || key == "Ref" { - switch key { - case "Fn::Base64": - fallthrough - case "Fn::FindInMap": - fallthrough - case "Fn::GetAZs": - fallthrough - case "Fn::Select": - fallthrough - case "Fn::Split": - util.LogWarning(-1, "PostProcessing", "Intrinsic function %s ", key) - case "Fn::ImportValue": - return "" - case "Fn::Join": - valueArray, arrayOk := value.([]interface{}) - if !arrayOk { - util.LogError(-1, "PostProcessing", "Fn::Join function received wrong input `%s`", value) - } else { - return fnJoin(valueArray, resources) - } - case "Fn::GetAtt": - valueArray, arrayOk := value.([]interface{}) - if !arrayOk { - util.LogError(-1, "PostProcessing", "Fn::GetAtt function received wrong input `%s`", value) - } else { - valueLen := len(valueArray) - if valueLen != 2 { - util.LogError(-1, "PostProcessing", "Wrong number of attributes %d for Fn::GetAtt %s", valueLen, value) - } else { - valueResource, valueResourceString := valueArray[0].(string) - valueAttribute, valueAttributeString := valueArray[1].(string) - - if !valueResourceString || !valueAttributeString { - util.LogError(-1, "PostProcessing", "Attributes for Fn::GetAtt must be Strings.") - } else { - compiledValue := valueResource + `.` + valueAttribute - return fnGetAtt(compiledValue, resources) - } - } - } - case "Fn::Sub": - valueArray, arrayOk := value.([]interface{}) - if !arrayOk { - // It's not an array. Maybe it's a string? - valueString, valueStringOk := value.(string) - if !valueStringOk { - util.LogError(-1, "PostProcessing", "Fn::Sub needs either an array or a String.") - } else { - return fnSub(valueString, resources, nil) - } - } else { - return complexFnSub(valueArray, resources) - } - case "Ref": - valueString, valueStringOk := value.(string) - if !valueStringOk { - util.LogError(-1, "PostProcessing", "Ref function requires a string.") - } else { - return resolveValue(valueString, resources) - } - } - } else { - // innerValue := &processedProperty{ - // _original: value, - // _value: nil, - // } - innerValue := recursiveObjectLookup(key, value, resources) - return innerValue - } - - return nil -} diff --git a/vendor/github.com/awslabs/goformation/resources/aws-serverless-function-event-source.go b/vendor/github.com/awslabs/goformation/resources/aws-serverless-function-event-source.go deleted file mode 100644 index 8d39f67dbd..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/aws-serverless-function-event-source.go +++ /dev/null @@ -1,189 +0,0 @@ -package resources - -import ( - "strings" - - "github.com/awslabs/goformation/util" -) - -// EventSource represents each of a function's event sources -// The properties are captures as a yaml.MapSlice so they can be -// unmarshalled at runtime into different event type structs depending -// on the event source Type. -type AWSServerlessFunctionEventSource interface { - Type() string - Properties() map[string]string -} - -type eventSource struct { - EType string `yaml:"Type"` - EProperties map[string]string `yaml:"Properties"` -} - -// -// AWSServerlessFunctionEventSource interface -// - -func (e *eventSource) Type() string { - return e.EType -} - -func (e *eventSource) Properties() map[string]string { - return e.EProperties -} - -// -// End AWSServerlessFunctionEventSource interface -// - -// -// Scaffoldable interface -// -func (e *eventSource) Scaffold(input Resource, propName string) (Resource, error) { - // TODO Set proper event (API, SFN) if exists - - propRaw := input.Properties()[propName] - prop := propRaw.Value().(map[string]interface{}) - e.EType = prop["Type"].(string) - e.EProperties = prop["Properties"].(map[string]string) - - return input, nil -} - -func scaffoldEventSourceMap(prop Property) map[string]AWSServerlessFunctionEventSource { - propValue := prop.Value() - if propValue == nil { - return make(map[string]AWSServerlessFunctionEventSource) - } - - events, eventsOk := propValue.(map[string]Property) - if !eventsOk { - evtString, evtStringOk := propValue.(string) - if evtStringOk { - util.LogDebug(-1, "AWS::Serverless::Function", "`Events` is a string: %s", evtString) - return map[string]AWSServerlessFunctionEventSource{} - } - - } - resultEvents := make(map[string]AWSServerlessFunctionEventSource) - for key, esProp := range events { - propValue := esProp.Value().(map[string]Property) - propType := propValue["Type"].Value().(string) - propProperties := propValue["Properties"].Value() - - newProps := make(map[string]string) - oldProps, oldPropsOk := propProperties.(map[interface{}]interface{}) - if oldPropsOk { - for pKey, pValue := range oldProps { - var ppKey string - var ppValue string - - if keyPtr, keyPtrOk := pKey.(*string); keyPtrOk { - ppKey = *keyPtr - } else { - ppKey = pKey.(string) - } - - if pValueArray, pValueArrayOk := pValue.([]interface{}); pValueArrayOk { - strArray := make([]string, len(pValueArray)) - for ppk, ppv := range pValueArray { - strArray[ppk] = ppv.(string) - } - - ppValue = strings.Join(strArray, ", ") - } else if pValueMap, pValueMapOk := pValue.(map[interface{}]interface{}); pValueMapOk { - strMap := make(map[string]string) - for ppk, ppv := range pValueMap { - strMap[ppk.(string)] = ppv.(string) - } - - ppValue = "Temprarily unmapped" - } else { - ppValue = pValue.(string) - } - - newProps[ppKey] = ppValue - } - } else if propProp, propPropOk := propProperties.(Property); propPropOk { - propPropValue := propProp.Value() - propertiesMap := propPropValue.(map[string]string) - newProps = propertiesMap - } - - var event AWSServerlessFunctionEventSource = &eventSource{ - EType: propType, - EProperties: newProps, - } - if propType == "Api" { - apiEvent := scaffolfApiEventSource(event) - event = apiEvent - } - - resultEvents[key] = event - - } - - return resultEvents -} - -// -// End AWSServerlessFunctionEventSource interface -// - -// AWSServerlessFunctionAPIEventSource Represents Lambda event sources linked to an API Gateway. -type AWSServerlessFunctionAPIEventSource interface { - Path() string - Methods() []string - Api() string - Type() string - Properties() map[string]string -} - -type apiEventSource struct { - FPath string `yaml:"Path"` - FMethod string `yaml:"Method"` - FRestAPI string `yaml:"RestApiId"` - original AWSServerlessFunctionEventSource -} - -func (a *apiEventSource) Type() string { - return a.original.Type() -} - -func (a *apiEventSource) Properties() map[string]string { - return a.original.Properties() -} - -// Path returns the HTTP path the function should be mounted at -func (a *apiEventSource) Path() string { - return a.FPath -} - -// Methods returns a list of HTTP methods for the event source -func (a *apiEventSource) Methods() []string { - - switch strings.ToLower(a.FMethod) { - case "any": - return []string{"OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"} - default: - return []string{strings.ToUpper(a.FMethod)} - } -} - -// Api returns the Rest API for this event source -func (a *apiEventSource) Api() string { - return a.FRestAPI -} - -func scaffolfApiEventSource(event AWSServerlessFunctionEventSource) AWSServerlessFunctionAPIEventSource { - - aes := &apiEventSource{} - aes.original = event - - eventProps := event.Properties() - aes.FPath = eventProps["Path"] - aes.FMethod = eventProps["Method"] - aes.FRestAPI = eventProps["RestApiId"] - - return aes -} diff --git a/vendor/github.com/awslabs/goformation/resources/aws-serverless-function.go b/vendor/github.com/awslabs/goformation/resources/aws-serverless-function.go deleted file mode 100644 index 2a72954f17..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/aws-serverless-function.go +++ /dev/null @@ -1,384 +0,0 @@ -package resources - -import ( - "github.com/awslabs/goformation/util" -) - -// AWSServerlessFunction is a broad interface that allows us to pass around -// functions of any AWS SAM specification version, while keeping -// a common interface that they should all adhear to -type AWSServerlessFunction interface { - Handler() string - Runtime() string - CodeURI() AWSCommonStringOrS3Location - FunctionName() string - Description() string - MemorySize() int - Timeout() int - Role() interface{} - Policies() []string - EnvironmentVariables() map[string]string - Endpoints() ([]AWSServerlessFunctionEndpoint, error) -} - -// AWSServerlessFunctionEndpoint provides information on where a Serverless function -// should be mounted on an API (for example, the HTTP method and path) -type AWSServerlessFunctionEndpoint interface { - Path() string - Methods() []string -} - -type awsServerlessFunction struct { -} - -// -// ResourceDefinition interface -// - -func (f *awsServerlessFunction) ResourceType() string { - return awsServerlessFunctionResourceType() -} - -func (f *awsServerlessFunction) Template(source interface{}) Resource { - template := &functionTemplate{} - util.ParseComplex(source, template) - - return template -} - -var fnDef, fnDefErr = functionDefinition() - -func (f *awsServerlessFunction) Resource() (Resource, error) { - if fnDefErr != nil { - return nil, fnDefErr - } - - return fnDef, nil -} - -func (f *awsServerlessFunction) ClassConstructor(input Resource) (Resource, error) { - - res, error := f.Scaffold(input, "") - if error != nil { - return nil, error - } - - return res.(Resource), nil -} - -// -// End ResourceDefinition interface -// - -// -// Scaffoldable interface -// - -// TODO Document -func (f *awsServerlessFunction) Scaffold(input Resource, propName string) (AWSServerlessFunction, error) { - function := &functionTemplate{} - function.Scaffold(input, "") - - return function, nil -} - -// -// End Scaffoldable interface -// - -func awsServerlessFunctionResourceType() string { - return "AWS::Serverless::Function" -} - -type functionTemplate struct { - FHandler string `yaml:"Handler"` - FRuntime string `yaml:"Runtime"` - FCodeURI *stringOrS3Location `yaml:"CodeUri"` - FFunctionName string `yaml:"FunctionName"` - FDescription string `yaml:"Description"` - FMemorySize int `yaml:"MemorySize"` - FTimeout int `yaml:"Timeout"` - FRole interface{} `yaml:"Role"` - FPolicies ListOrString `yaml:"Policies"` - FEnvironment map[string]string `yaml:"Environment"` - FVpcConfig interface{} `yaml:"VpcConfig"` - FEventSources map[string]AWSServerlessFunctionEventSource `yaml:"Events"` - Resource -} - -// -// Resource interface -// -func (f *functionTemplate) Type() string { - return awsServerlessFunctionResourceType() -} - -func (f *functionTemplate) Properties() map[string]Property { - resource := f.Resource - return resource.Properties() -} - -func (f *functionTemplate) ReturnValues() map[string]string { - resource := f.Resource - return resource.ReturnValues() -} - -// -// End Resource interface -// - -// -// Scaffoldable interface -// - -func (f *functionTemplate) Scaffold(input Resource, propName string) (Resource, error) { - f.Resource = input - - resourceProperties := input.Properties() - - f.FDescription = safeProcessString(resourceProperties["Description"]) - f.FHandler = safeProcessString(resourceProperties["Handler"]) - f.FRuntime = safeProcessString(resourceProperties["Runtime"]) - f.FFunctionName = safeProcessString(resourceProperties["FunctionName"]) - f.FMemorySize = safeProcessInt(resourceProperties["MemorySize"]) - f.FTimeout = safeProcessInt(resourceProperties["Timeout"]) - f.FRole = safeProcessString(resourceProperties["Role"]) - f.FPolicies = safeProcessStringArray(resourceProperties["Policies"]) - - envValue := resourceProperties["Environment"].Value() - if envValue != nil { - fEnvironmentObject, fEnvironmentObjectOk := envValue.(map[string]Property) - if fEnvironmentObjectOk { - f.FEnvironment = safeProcessStringMap(fEnvironmentObject["Variables"]) - } else { - util.LogDebug(-1, "AWS::Serverless::Function", "The environment has a wrong type") - } - } - - f.FCodeURI = &stringOrS3Location{} - f.FCodeURI.Scaffold(input, "CodeUri") - f.FEventSources = scaffoldEventSourceMap(resourceProperties["Events"]) - - // FVpcConfig = resourceProperties["VpcConfig"].Value() - // FResource = resourceProperties["Resource"].Value() - - // TODO Finish this - - return nil, nil -} - -// -// End Scaffoldable interface -// - -// -// AWSServerlessFunction interface -// -func (f *functionTemplate) Handler() string { - return f.FHandler -} - -func (f *functionTemplate) Runtime() string { - return f.FRuntime -} - -func (f *functionTemplate) CodeURI() AWSCommonStringOrS3Location { - return f.FCodeURI -} - -func (f *functionTemplate) FunctionName() string { - return f.FFunctionName -} - -func (f *functionTemplate) Description() string { - return f.FDescription -} - -func (f *functionTemplate) MemorySize() int { - return f.FMemorySize -} - -func (f *functionTemplate) Timeout() int { - return f.FTimeout -} -func (f *functionTemplate) Role() interface{} { - return f.FRole -} - -func (f *functionTemplate) Policies() []string { - return f.FPolicies -} - -func (f *functionTemplate) EnvironmentVariables() map[string]string { - return f.FEnvironment -} - -// -// End AWSServerlessFunction interface -// - -func (f *functionTemplate) Endpoints() ([]AWSServerlessFunctionEndpoint, error) { - - var endpoints = []AWSServerlessFunctionEndpoint{} - - for _, es := range f.FEventSources { - if es.Type() == "Api" { - if esApi, esApiOk := es.(AWSServerlessFunctionAPIEventSource); esApiOk { - endpoints = append(endpoints, esApi.(*apiEventSource)) - } - } - } - - return endpoints, nil - -} - -func functionDefinition() (Resource, error) { - var resource Resource - var error error - - config := map[string]interface{}{ - "Type": awsServerlessFunctionResourceType(), - "Properties": map[string]map[string]interface{}{ - "Handler": map[string]interface{}{ - "Types": "string", - "Required": true, - "Default": "index.handler", - }, - "Runtime": map[string]interface{}{ - "Types": "string", - "Required": true, - "Validator": func(rawValue interface{}) (bool, string) { - value := rawValue.(string) - - switch value { - case "nodejs": - fallthrough - case "nodejs4.3": - fallthrough - case "nodejs6.10": - fallthrough - case "java8": - fallthrough - case "python2.7": - fallthrough - case "python3.6": - fallthrough - case "dotnetcore1.0": - fallthrough - case "nodejs4.3-edge": - return true, "" - } - return false, `Invalid value ` + value + `. Valid values are "nodejs", "nodejs4.3", "nodejs6.10", "java8", "python2.7", "python3.6", "dotnetcore1.0", "nodejs4.3-edge"` - }, - }, - "CodeUri": map[string]interface{}{ - "Types": []string{"Resource", "string"}, - "Required": false, - "Resource": map[string]map[string]interface{}{ - "Bucket": map[string]interface{}{ - "Types": "string", - "Required": true, - }, - "Key": map[string]interface{}{ - "Types": "string", - "Required": true, - }, - "Version": map[string]interface{}{ - "Types": "int", - "Required": false, - }, - }, - }, - "FunctionName": map[string]interface{}{ - "Types": "string", - "Default": func(fn Resource) interface{} { - return "ABCD" - // TODO Set Name based on LogicalId - }, - "Validator": func(source interface{}) (bool, string) { - // Otherwise - var result = true - - return result, "" - }, - }, - "Description": map[string]interface{}{ - "Types": "string", - }, - "MemorySize": map[string]interface{}{ - "Types": "int", - "Default": 128, - }, - "Timeout": map[string]interface{}{ - "Types": "int", - "Default": 3, - }, - "Role": map[string]interface{}{ - "Types": "string", - }, - "Policies": map[string]interface{}{ - "Types": []string{"Resource", "[]Resource", "string", "[]string"}, - "Resource": map[string]map[string]interface{}{}, - // TODO Policies validation NOT implemented - }, - "Environment": map[string]interface{}{ - "Types": "Resource", - "Resource": map[string]map[string]interface{}{ - "Variables": map[string]interface{}{ - "Types": "map[string]string", - }, - }, - }, - "VpcConfig": map[string]interface{}{ - "Types": "Resource", - "Resource": map[string]map[string]interface{}{}, - // TODO VPCConfig validation NOT implemented - }, - "Events": map[string]interface{}{ - "Types": "map[string]Resource", - "Resource": map[string]map[string]interface{}{ - "Type": map[string]interface{}{ - "Types": "string", - "Validator": func(source interface{}) (bool, string) { - // Otherwise - var result = true - - return result, "" - }, - "Required": true, - }, - "Properties": map[string]interface{}{ - "Types": "map[string]string", - "Required": true, - }, - }, - // TODO Events validation NOT implemented - }, - "Tags": map[string]interface{}{ - "Types": "map[string]string", - }, - }, - "ReturnValues": map[string]func(Resource) interface{}{ - "Ref": func(fn Resource) interface{} { - fnProperties := fn.Properties() - functionName := fnProperties["FunctionName"].Value().(string) - return functionName - }, - "Arn": func(fn Resource) interface{} { - fnProperties := fn.Properties() - functionName := fnProperties["FunctionName"].Value().(string) - var arn = "arn:aws:lambda:region:account-id:function:" + functionName - - return arn - }, - }, - } - - resource, error = DefineResource(config) - if error != nil { - return nil, error - } - - return resource, nil -} diff --git a/vendor/github.com/awslabs/goformation/resources/common-list-or-string.go b/vendor/github.com/awslabs/goformation/resources/common-list-or-string.go deleted file mode 100644 index 1dcb7a9f64..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/common-list-or-string.go +++ /dev/null @@ -1,35 +0,0 @@ -package resources - -import "fmt" - -// ListOrString defines an ambiguous type for YAML document, which can take -// a list of strings by default but also a single string literal. -type ListOrString []string - -// UnmarshalYAML defines a way to unmarshal variables of ListOrString. -func (e *ListOrString) UnmarshalYAML(unmarshal func(interface{}) error) (err error) { - - var aux interface{} - if err = unmarshal(&aux); err != nil { - return - } - - switch raw := aux.(type) { - case string: - *e = []string{raw} - - case []interface{}: - list := make([]string, len(raw)) - for i, r := range raw { - v, ok := r.(string) - if !ok { - return fmt.Errorf("An item in evn cannot be converted to a string: %v", aux) - } - list[i] = v - } - *e = list - - } - return - -} diff --git a/vendor/github.com/awslabs/goformation/resources/common-s3-location.go b/vendor/github.com/awslabs/goformation/resources/common-s3-location.go deleted file mode 100644 index 66c97adbbe..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/common-s3-location.go +++ /dev/null @@ -1,72 +0,0 @@ -package resources - -import ( - "net/url" -) - -// TODO Document -type AWSCommonS3Location interface { - Bucket() string - Key() string - Version() int -} - -// S3Location represents an S3 location, ususally passed as the -// CodeUri for a Serverless Function -type s3Location struct { - bucket string - key string - version int -} - -func (s3 *s3Location) Bucket() string { - return s3.bucket -} -func (s3 *s3Location) Key() string { - return s3.key -} -func (s3 *s3Location) Version() int { - return s3.version -} - -func (s3 *s3Location) Scaffold(input Resource, propName string) (Resource, error) { - - propertyValue := input.Properties()[propName].Value() - - switch raw := propertyValue.(type) { - case string: - - // The location has been specified as a string. - // Parse out the bucket/key and populate an - u, err := url.Parse(raw) - if err != nil { - return nil, err - } - - s3.bucket = u.Host - s3.key = u.Path - - case map[string]Property: - - for name, property := range raw { - switch name { - case "Bucket": - if bucket, ok := property.Value().(string); ok { - s3.bucket = bucket - } - case "Key": - if key, ok := property.Value().(string); ok { - s3.key = key - } - case "Version": - if version, ok := property.Value().(int); ok { - s3.version = version - } - } - } - - } - - return nil, nil - -} diff --git a/vendor/github.com/awslabs/goformation/resources/common-string-or-s3-location.go b/vendor/github.com/awslabs/goformation/resources/common-string-or-s3-location.go deleted file mode 100644 index 26187f6c76..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/common-string-or-s3-location.go +++ /dev/null @@ -1,49 +0,0 @@ -package resources - -import ( - "fmt" - - "github.com/awslabs/goformation/util" -) - -// AWSCommonStringOrS3Location allows a field in a template (e.g. CodeUri) to be specified as -// either an S3 location object (Bucket, Key, Version), or a plain string. -type AWSCommonStringOrS3Location interface { - String() string -} - -type stringOrS3Location struct { - location string -} - -// String returns either the S3 bucket location (in s3://bucket/key#version format) or the string -func (sos3 *stringOrS3Location) String() string { - return sos3.location -} - -func (sos3 *stringOrS3Location) Scaffold(input Resource, propName string) (Resource, error) { - - value := input.Properties()[propName].Value() - - switch value.(type) { - case string: - sos3.location = util.ParsePrimitive(value).(string) - - case map[string]Property: - - s3l := &s3Location{} - - resource, err := s3l.Scaffold(input, propName) - if err != nil { - return nil, err - } - - sos3.location = fmt.Sprintf("s3://%s/%s#%d", s3l.Bucket(), s3l.Key(), s3l.Version()) - - return resource, nil - - } - - return nil, nil - -} diff --git a/vendor/github.com/awslabs/goformation/resources/factory.go b/vendor/github.com/awslabs/goformation/resources/factory.go deleted file mode 100644 index f5d765c725..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/factory.go +++ /dev/null @@ -1,52 +0,0 @@ -package resources - -// TODO Document -type ResourceFactoryInterface interface { - AddResourceDefinition(resourceDefinition ResourceDefinition) error - GetResourceDefinition(logicalID string) ResourceDefinition - GetResourceByType(_type string) ResourceDefinition -} - -// TODO Document -var resourceFactory ResourceFactoryInterface - -// TODO Document -func GetResourceFactory() ResourceFactoryInterface { - if resourceFactory == nil { - resourceFactory = &factory{} - - resourceFactory.AddResourceDefinition(&awsServerlessFunction{}) - } - - return resourceFactory -} - -type factory struct { - _definitions []ResourceDefinition -} - -func (f *factory) AddResourceDefinition(resourceDefinition ResourceDefinition) error { - if f._definitions == nil { - f._definitions = []ResourceDefinition{} - } - - f._definitions = append(f._definitions, resourceDefinition) - - return nil -} - -func (f *factory) GetResourceDefinition(logicalID string) ResourceDefinition { - return nil -} - -func (f *factory) GetResourceByType(_type string) ResourceDefinition { - for _, value := range f._definitions { - resourceType := value.ResourceType() - - if _type == resourceType { - return value - } - } - - return nil -} diff --git a/vendor/github.com/awslabs/goformation/resources/interfaces.go b/vendor/github.com/awslabs/goformation/resources/interfaces.go deleted file mode 100644 index e020fb79cf..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/interfaces.go +++ /dev/null @@ -1,53 +0,0 @@ -package resources - -// TODO Document -type Template interface { - Version() string - Transform() []string - Parameters() map[string]Parameter - Resources() map[string]Resource - Outputs() map[string]Output - - GetResourcesByType(resourceType string) map[string]Resource -} - -// TODO Document -type Parameter interface { - AllowedPattern() string - AllowedValues() []string - ConstraintDescription() string - Default() string - Description() string - MaxLength() string - MaxValue() string - MinLength() string - MinValue() string - NoEcho() string - Type() string -} - -// TODO Document -type Resource interface { - Type() string - Properties() map[string]Property - ReturnValues() map[string]string -} - -// TODO Document -type Property interface { - Value() interface{} - Original() interface{} - HasFn() bool -} - -// TODO Outputs -type Output interface { - Description() string - Value() string - Export() ExportParam -} - -// TODO Document -type ExportParam interface { - Name() string -} diff --git a/vendor/github.com/awslabs/goformation/resources/line-numbers.go b/vendor/github.com/awslabs/goformation/resources/line-numbers.go deleted file mode 100644 index 37e7170722..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/line-numbers.go +++ /dev/null @@ -1,256 +0,0 @@ -package resources - -import ( - "errors" - "log" - "regexp" -) - -var ( - // ErrNoIntrinsicFunctionFound Launched when calling param processor without intrinsic. - // This Doesn't propagate, and it just tells the marshaller to stop attempting to resolve. - ErrNoIntrinsicFunctionFound = errors.New("No intrinsic function found") -) - -func ProcessLineNumbers(input []byte) LineDictionary { - level0Regex := regexp.MustCompile(`(Parameters|Resources|Outputs):`) - keyValueRegex := regexp.MustCompile(`([\w]+):\s*(.*)`) - awsFnValueRegex := regexp.MustCompile(`(Fn::)(Base64|FindInMap|GetAtt|GetAZs|ImportValue|Join|Select|Split|Sub):\s*(.*)`) - arrayItemRegex := regexp.MustCompile(`\-\s*(.*)`) - multilineRegex := regexp.MustCompile(`.+\|`) - - lineRegex := `\n([ \t]*)([A-Za-z0-9:\-_,\<\>\=\+\*\. \[\]\{\}\(\)\/\\\"\'$#!\|]+)?` - compiledRegex := regexp.MustCompile(lineRegex) - - template := `\n` + string(input) // TODO Improve concat - - occurrences := compiledRegex.FindAllStringSubmatch(template, -1) - - // Create Root level - var RootObj = &lineDictionary{ - _line: 0, - _level: -1, - _indentLevel: -1, - _value: "ROOT", - _type: "TemplateRoot", - _end: false, - } - - var tabsAreTabsRegex = `\t` - var previousDictionary = RootObj - var currentParent = RootObj - parentHierarchy := map[int]*lineDictionary{ - -1: RootObj, - } - multilineActive := false - multilineLevel := -1 - indentSpacing := -1 - for line, occurrence := range occurrences { - var tabs = occurrence[1] - var value = occurrence[2] - - multiLineMatch := multilineRegex.MatchString(value) - - // Ignore empty line - if len(value) == 0 { - continue - } - // TODO Ignore line with only spaces - - tabsAreTabs, _ := regexp.Match(tabsAreTabsRegex, []byte(tabs)) - level := len(tabs) - - if indentSpacing == -1 && !multilineActive && !multiLineMatch && level > 0 { - indentSpacing = level - } - - indentLevel := level - if level > 0 && !tabsAreTabs { - if indentSpacing == -1 { - indentSpacing = 2 - } - - indentLevel = level / indentSpacing - } - - if multilineActive { - if indentLevel > multilineLevel { - previousDictionary._value += value - continue - } - - multilineActive = false - multilineLevel = -1 - } - - if multiLineMatch { - multilineActive = true - multilineLevel = indentLevel - } - - dictionary := &lineDictionary{ - _line: line + 2, // FIXME Line 1 is not yet being parsed (and +1 to start in 1.) - _level: level, - _indentLevel: indentLevel, - _value: value, - } - - // if !tabsAreTabs { - // dictionary._level *= 2 - // } - - // Have we increased, decreased, or maintain level? - levelDiff := indentLevel - previousDictionary.IndentLevel() - - if levelDiff == 0 { - // If we maintain, we still don't know what to do. Let's just store the item and keep going. - // That's done below. - - // My parent is the previous's parent, as I didn't change level. - currentParent = previousDictionary._parent - } else if levelDiff < 0 { - // If the substraction is negative, it means we decreased one or more levels. - // The parent has to change to this current, and the previous needs to be marked as End. - openedParent, openedParentOk := parentHierarchy[indentLevel-1] - if !openedParentOk { - log.Panicf("PANIC: YAML contains malformed structures") - } - - currentParent = openedParent - } else { - parentHierarchy[previousDictionary._indentLevel] = previousDictionary - // Otherwise we have increased a level, and that means appending children to the previous - // and set it up as a parent so we could keep adding children. - - // My parent is, obviously, the previous'. - currentParent = previousDictionary - } - - switch level { - case 0: - // We are either defining `Parameters`, `Resources`, or `Outputs` - if level0Regex.MatchString(value) { - // When parsing we found a non-valid level 1. - // TODO What to do? - attribute := level0Regex.FindStringSubmatch(value) - dictionary._key = attribute[1] - } else { - // We are defining other things - e.g. Version, Transform, Description... - dictionary._type = value - } - case 1: - // We are either defining `Parameters`, `Resources`, or `Outputs` - if keyValueRegex.MatchString(value) { - // When parsing we found a non-valid level 1. - // TODO What to do? - attribute := keyValueRegex.FindStringSubmatch(value) - dictionary._type = attribute[1] - dictionary._key = attribute[1] - dictionary._value = attribute[2] - } else { - dictionary._type = value - } - default: - // Either properties or subproperties. - // We'll call it all `Props`, to be cool. - dictionary._type = "Props" - - if awsFnValueRegex.MatchString(value) { - attribute := awsFnValueRegex.FindStringSubmatch(value) - dictionary._key = attribute[1] + attribute[2] - dictionary._value = attribute[3] - } else if keyValueRegex.MatchString(value) { - // When parsing we found a non-valid level 1. - // TODO What to do? - attribute := keyValueRegex.FindStringSubmatch(value) - dictionary._key = attribute[1] - dictionary._value = attribute[2] - } else if arrayItemRegex.MatchString(value) { - // Line is an array item. Process it like that - - attribute := arrayItemRegex.FindStringSubmatch(value) - dictionary._key = attribute[1] - if len(attribute) > 2 { - dictionary._value = attribute[2] - } else { - dictionary._value = dictionary._key - } - } - } - - // Append the element to the parent. - currentParent.SetChildren(append(currentParent.Children(), dictionary)) - dictionary._parent = currentParent - previousDictionary = dictionary - - if currentParent.IndentLevel() == -1 { - // XXX I got no clue why this is needed. - // FIXME Find why - RootObj = currentParent - } - } - - return RootObj -} - -// BEGIN lineDictionary definition - -type lineDictionary struct { - _line int - _level int - _indentLevel int - _key string - _value string - _type string - _parent *lineDictionary - _children []*lineDictionary - _end bool -} - -func (l *lineDictionary) Line() int { - return l._line -} -func (l *lineDictionary) Level() int { - return l._level -} -func (l *lineDictionary) IndentLevel() int { - return l._indentLevel -} -func (l *lineDictionary) Key() string { - return l._key -} -func (l *lineDictionary) Value() string { - return l._value -} -func (l *lineDictionary) Type() string { - return l._type -} -func (l *lineDictionary) Parent() LineDictionary { - return l._parent -} -func (l *lineDictionary) Children() []LineDictionary { - if l == nil { - return make([]LineDictionary, 0) - } - - numChildren := 0 - if l._children != nil { - numChildren = len(l._children) - } - ret := make([]LineDictionary, numChildren) - for key, value := range l._children { - ret[key] = value - } - return ret -} -func (l *lineDictionary) End() bool { - return l._end -} -func (l *lineDictionary) SetChildren(input []LineDictionary) { - l._children = make([]*lineDictionary, len(input)) - for key, value := range input { - l._children[key] = value.(*lineDictionary) - } -} - -// END lineDictionary definition diff --git a/vendor/github.com/awslabs/goformation/resources/property.go b/vendor/github.com/awslabs/goformation/resources/property.go deleted file mode 100644 index 7a95d4a1b5..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/property.go +++ /dev/null @@ -1,700 +0,0 @@ -package resources - -import ( - "regexp" - "strings" - - "github.com/pkg/errors" - - "github.com/awslabs/goformation/util" -) - -// ErrUnsetPropertyType The property type has been not set -var ErrUnsetPropertyType = errors.New("Every property needs to have at least one data type") - -// ErrInvalidPropertyTypeObject The `type` object given is invalid -var ErrInvalidPropertyTypeObject = errors.New("The types definition for a Property must be either a String or an Array of strings") - -// ErrInvalidPropertyType One of the types given to the property is invalid -var ErrInvalidPropertyType = errors.New("One of the given types is invalid") - -// ErrInvalidPropertyDefaultValueType The default value given for the property has an invalidType -var ErrInvalidPropertyDefaultValueType = errors.New("The default value set for the property is not a valid type") - -// ErrInvalidPropertyValueType The value given to the property has an invalid type -var ErrInvalidPropertyValueType = errors.New("The type of the value set for the property is incorrect") - -// ErrResourceNotSetForReferencedProperty Referenced properties need to have a Resource associated -var ErrResourceNotSetForReferencedProperty = errors.New("Referenced types need to have a resource. Use `newReferenceProperty` method instead") - -// ErrPropertyDefinitionUnsetType Property definition without types -var ErrPropertyDefinitionUnsetType = errors.New("When defining a property you must indicate its type") - -// ErrTreatingASimpleVariableAsComplex Treating a primitive value as an object -var ErrTreatingASimpleVariableAsComplex = errors.New("Treating a primitive value as an object") - -// ErrPropertyDidntPassSpecificValidation Occurs when the property-specific validations don't validate the property value -var ErrPropertyDidntPassSpecificValidation = errors.New("Unable to validate the property against its specific validators") - -// newProperty Creates a new Property with the information given in the template -func newProperty(types interface{}, required bool, defaultValue interface{}, validator func(source interface{}) (bool, string)) (Property, error) { - var prop Property - - realTypes, error := validatePropertyTypes(types, required, defaultValue) - if error != nil { - util.LogError(-1, "Properties", "Error validating Property types.") - return nil, error - } - - if validType, _ := valueTypeIsValid(&realTypes, defaultValue); !validType { - error = ErrInvalidPropertyDefaultValueType - return nil, error - } - - // Reject Referenced types - if realTypes[0] == "Resource" || realTypes[0] == "[]Resource" { - util.LogError(-1, "Properties", "Rejected using simple property definition for %s", realTypes) - error = ErrResourceNotSetForReferencedProperty - return nil, error - } - - prop = &property{ - _types: realTypes, - _required: required, - _default: defaultValue, - _validator: validator, - } - - return prop, error -} - -// newReferenceProperty Creates a property that references other resource -func newReferenceProperty(types interface{}, required bool, res map[string]*property, validator func(source interface{}) (bool, string)) (Property, error) { - - realTypes, error := validatePropertyTypes(types, required, nil) - - if error != nil { - return nil, error - } - - prop := property{ - _types: realTypes, - _required: required, - _resource: res, - _validator: validator, - } - - return &prop, nil -} - -// DefineProperty Defines a new property with the data given -func DefineProperty(config map[string]interface{}) (Property, error) { - util.LogDebug(-1, "Properties", "Starting Property definition") - var prop Property - var error error - - var propTypes interface{} - var propRequired = false - var propDefault interface{} - var propValidator func(interface{}) (bool, string) - var propReference map[string]*property - - util.LogDebug(-1, "Properties", "Creating Property's attributes") - isReference := false - for key, attribute := range config { - switch key { - case "Types": - propTypes = attribute - case "Required": - propRequired = attribute.(bool) - case "Default": - propDefault = attribute - case "Resource": - isReference = true - ref, error := parseInnerProperties(attribute.(map[string]map[string]interface{})) - if error != nil { - return nil, error - } - propReference = ref - case "Validator": - propValidator = attribute.(func(interface{}) (bool, string)) - } - } - - if propTypes == nil { - error = ErrPropertyDefinitionUnsetType - } else if isReference { - prop, error = newReferenceProperty(propTypes, propRequired, propReference, propValidator) - } else { - prop, error = newProperty(propTypes, propRequired, propDefault, propValidator) - } - - if error != nil { - return nil, error - } - - return prop, nil -} - -func parseInnerProperties(source map[string]map[string]interface{}) (map[string]*property, error) { - util.LogDebug(-1, "Properties", "Defining Property's inner Properties") - result := make(map[string]*property) - for key, value := range source { - util.LogDebug(-1, "Properties", "Defining inner property %s", key) - prop, error := DefineProperty(value) - if error != nil { - util.LogError(-1, "Properties", "Failed to define property %s", key) - return nil, error - } - - util.LogDebug(-1, "Properties", "Storing inner Property") - result[key] = prop.(*property) - } - - return result, nil -} - -// Begin property definition - -type property struct { - _types []string - _required bool - _default interface{} - _validator func(source interface{}) (bool, string) - _resource map[string]*property - _value interface{} -} - -func (p *property) HasFn() bool { - return false -} -func (p *property) Original() interface{} { - return p._value -} -func (p *property) Scaffold(name string, propValue Property, source Resource, lines map[string]interface{}) (Property, error) { - var error error - - // Verify if data is not set for this property - if propValue == nil { - util.LogDebug(-1, "Properties", "Property has no assigned value") - - util.LogDebug(-1, "Properties", "Trying to apply default value") - rawDefaultValue := p._default - if rawDefaultValue != nil { - var valueToSet interface{} - - // The default value is a function? - if defaultValueFn, defaultIsFn := rawDefaultValue.(func(Resource) interface{}); defaultIsFn { - util.LogDebug(-1, "Properties", "The default value is a function") - tempValue := defaultValueFn(source) - valueToSet = tempValue - } else { - valueToSet = rawDefaultValue - } - util.LogDebug(-1, "Properties", "The default value to set is %s", valueToSet) - - currentProp, error := doScaffold(valueToSet, p, source, lines) - if error != nil { - return nil, error - } - - return currentProp, nil - } - - if p._required { - util.LogError(-1, "Properties", "The property is required, but no value has been set.") - error = ErrScaffoldRequiredValueNotSet - return nil, error - } - - // Create a nil property - util.LogDebug(-1, "Properties", "Value not set. Creating empty Property") - prop := &property{ - _value: nil, - } - - return prop, nil - - } - - var propLines LineDictionary - rootLines, rootLinesOk := lines["ROOT"] - if rootLinesOk { - propLines = rootLines.(LineDictionary) - } else { - propLines = &lineDictionary{ - _line: -1, - } - } - - value := propValue.Original() - util.LogDebug(-1, "Properties", "Property has the template value set to %s (line: %d; col: %d)", value, propLines.Line(), propLines.Level()) - - currentProp, error := doScaffold(value, p, source, lines) - if error != nil { - return nil, error - } - - return currentProp, nil -} -func (p *property) Value() interface{} { - return p._value -} - -func doScaffold(value interface{}, prop *property, resource Resource, lines map[string]interface{}) (*property, error) { - var propLines LineDictionary - rootLines, rootLinesOk := lines["ROOT"] - if rootLinesOk { - propLines = rootLines.(LineDictionary) - } else { - propLines = &lineDictionary{ - _line: -1, - } - } - - util.LogDebug(-1, "Properties", "Verifying that property's value has correct type") - validType, dataType := valueTypeIsValid(&prop._types, value) - if !validType { - // TODO Set line - error := errors.Wrapf(ErrInvalidPropertyValueType, `Expecting "%s", got "%s" (line: %d; col: %d)`, strings.Join(prop._types, " or "), util.GetValueType(value), propLines.Line(), propLines.Level()) - return nil, error - } - - if dataType == "" { - util.LogDebug(-1, "Properties", "The value validator could not determine the value's type") - } - - var realValue interface{} - switch dataType { - case "map[string]Resource": - fallthrough - case "map[int]Resource": - parsedValue, error := doScaffoldMap(value.(map[interface{}]interface{}), prop, resource, lines) - if error != nil { - return nil, error - } - - realValue = parsedValue - case "Resource": - parsedValue, error := doScaffoldResource(value, prop, resource, lines) - if error != nil { - return nil, error - } - - realValue = parsedValue - case "[]Resource": - parsedValue, error := doScaffoldResourceArray(value.([]interface{}), prop, resource, lines) - if error != nil { - return nil, error - } - - realValue = parsedValue - case "infn": - realValue = value - case "string": - fallthrough - case "int": - fallthrough - case "int64": - fallthrough - case "float32": - fallthrough - case "float64": - fallthrough - case "bool": - fallthrough - case "[]string": - fallthrough - case "[]int": - fallthrough - case "[]int64": - fallthrough - case "[]float32": - fallthrough - case "[]float64": - fallthrough - case "[]bool": - fallthrough - case "map[string]string": - fallthrough - case "map[int]string": - fallthrough - default: - util.LogDebug(-1, "Properties", "Value assigned plain because type is %s", dataType) - realValue = value - } - - // Validate property against defined validations - propValidator := prop._validator - if propValidator != nil { - propValidation, validationError := propValidator(realValue) - if !propValidation { - util.LogError(propLines.Line(), "Properties", "The value %s has not pass property-specific validations", realValue) - wrappedError := errors.Wrapf(ErrPropertyDidntPassSpecificValidation, validationError+` (line: %d; col: %d)`, propLines.Line(), propLines.Level()) - return nil, wrappedError - } - } - - util.LogDebug(-1, "Properties", "Wrapping scaffolded property") - propValue := &property{ - _value: realValue, - } - - return propValue, nil -} - -func doScaffoldResourceArray(value []interface{}, prop *property, resource Resource, lines map[string]interface{}) ([]interface{}, error) { - util.LogDebug(-1, "Properties", "Property is a Resource array. Iterating") - ret := make([]interface{}, len(value)) - - // Create resource property - resourceProperty := &property{ - _types: []string{"Resource"}, - _default: prop._default, - _required: true, - _resource: prop._resource, - } - - for key, res := range value { - result, error := doScaffold(res, resourceProperty, resource, lines) - if error != nil { - return nil, error - } - - ret[key] = result - } - - return ret, nil -} - -func doScaffoldMap(value map[interface{}]interface{}, prop *property, resource Resource, lines map[string]interface{}) (map[interface{}]interface{}, error) { - util.LogDebug(-1, "Properties", "Property is a Resource map. Iterating") - ret := make(map[interface{}]interface{}, len(value)) - - // Create resource property - resourceProperty := &property{ - _types: []string{"Resource"}, - _default: prop._default, - _required: true, - _resource: prop._resource, - } - - for key, res := range value { - var mapPropertyLines map[string]interface{} - rootInnerPropLines, rootInnerPropLinesOk := lines[key.(string)] - if rootInnerPropLinesOk { - innerPropLinesMap, innerPropLinesMapOk := rootInnerPropLines.(map[string]interface{}) - if innerPropLinesMapOk { - mapPropertyLines = innerPropLinesMap - } - } - - util.LogDebug(-1, "Properties", "Processing Property %s", key) - tmpResult, error := doScaffold(res, resourceProperty, resource, mapPropertyLines) - if error != nil { - return nil, error - } - - ret[key] = tmpResult - } - - return ret, nil -} - -func doScaffoldResource(value interface{}, prop *property, resource Resource, lines map[string]interface{}) (interface{}, error) { - var propLines LineDictionary - rootLines, rootLinesOk := lines["ROOT"] - if rootLinesOk { - propLines = rootLines.(LineDictionary) - } else { - propLines = &lineDictionary{ - _line: -1, - } - } - - complexValue, complexValueOk := value.(map[interface{}]interface{}) - if !complexValueOk { - util.LogError(propLines.Line(), "Properties", "Property is set as complex, but no complex value given. %s", value) - return nil, errors.Wrapf(ErrTreatingASimpleVariableAsComplex, `Property expected type "Resource", got "%s" (line: %d; col: %d)`, util.GetValueType(value), propLines.Line(), propLines.Level()) - } - - propertiesProperties := prop._resource - propertyValues := make(map[string]Property) - for propKey, propProp := range propertiesProperties { - util.LogDebug(-1, "Properties", "Scaffolding inner property %s", propKey) - var keyFace interface{} = propKey - valueKey := complexValue[keyFace] - util.LogDebug(-1, "Properties", "Value set for inner Property %s: %s", propKey, valueKey) - - if propProp._required && valueKey == nil { - util.LogError(propLines.Line(), "Properties", "Inner property has no value, yet it's required.") - return nil, errors.Wrapf(ErrScaffoldRequiredValueNotSet, "Inner property %s is required (line: %d; col: %d)", propKey, propLines.Line(), propLines.Level()) - } - - propValue, error := doScaffold(valueKey, propProp, resource, lines) - if error != nil { - util.LogError(-1, "Properties", "Failed to scaffold inner Property %s", propKey) - return nil, error - } - - propertyValues[propKey] = propValue - } - - return propertyValues, nil -} - -// End property definition - -func typesAreValid(types *[]string) bool { - for _, t := range *types { - var isPrimitive = false - var isArray = false - var isMap = false - var isComplexMap = false - var isRef = false - - switch t { - case "string": - fallthrough - case "int": - fallthrough - case "int64": - fallthrough - case "float32": - fallthrough - case "float64": - fallthrough - case "bool": - isPrimitive = true - - case "[]string": - fallthrough - case "[]int": - fallthrough - case "[]int64": - fallthrough - case "[]float32": - fallthrough - case "[]float64": - fallthrough - case "[]bool": - isArray = true - case "map[string]Resource": - fallthrough - case "map[int]Resource": - isComplexMap = true - fallthrough - case "map[string]string": - fallthrough - case "map[int]string": - isMap = true - case "Resource": - fallthrough - case "[]Resource": - isRef = true - } - - if !(isPrimitive || isArray || isRef || isMap || isComplexMap) { - return false - } - } - return true -} - -func valueTypeIsValid(types *[]string, value interface{}) (bool, string) { - - if _, ok := value.(func(Resource) interface{}); ok { - util.LogDebug(-1, "Properties", "Property's value is set via a function") - return true, "" - } - - if value == nil { - util.LogDebug(-1, "Properties", "Value is null. Nothing to validate") - return true, "" - } - - // If the value has an intrinsic function, then don't raise validation error - regularIntrinsicFnRegex := regexp.MustCompile(`(Fn::(Base64|FindInMap|GetAtt|GetAZs|ImportValue|Join|Select|Split|Sub)|Ref)`) - valueComplex, valueComplexOk := value.(map[interface{}]interface{}) - if valueComplexOk { - for cKey := range valueComplex { - var ccKey string - if cKeyPtr, cKeyPtrOk := cKey.(*string); cKeyPtrOk { - ccKey = *cKeyPtr - } else { - ccKey = cKey.(string) - } - - if regularIntrinsicFnRegex.MatchString(ccKey) { - return true, "infn" - } - } - } else if valueArray, valueArrayOk := value.([]interface{}); valueArrayOk { - for _, cValue := range valueArray { - var valueStr string - if cValueStr, cValueStrOk := cValue.(string); cValueStrOk { - valueStr = cValueStr - } else if cValueStr, cValueStrOk := cValue.(*string); cValueStrOk { - valueStr = *cValueStr - } - - if regularIntrinsicFnRegex.MatchString(valueStr) { - return true, "string" - } - } - } else if valueStr, valueStrOk := value.(string); valueStrOk { - if regularIntrinsicFnRegex.MatchString(valueStr) { - return true, "string" - } - } - - validationResults := make([]bool, len(*types)) - - var dataType = "" - for index, t := range *types { - util.LogDebug(-1, "Properties", "Validating type %s", t) - validationResults[index] = true - switch t { - case "string": - _, ok := value.(string) - if !ok { - validationResults[index] = false - } - case "int": - _, ok := value.(int) - if !ok { - validationResults[index] = false - } - case "int64": - _, ok := value.(int64) - if !ok { - validationResults[index] = false - } - case "float32": - _, ok := value.(float32) - if !ok { - validationResults[index] = false - } - case "float64": - _, ok := value.(float64) - if !ok { - validationResults[index] = false - } - case "bool": - _, ok := value.(bool) - if !ok { - validationResults[index] = false - } - case "[]string": - _, ok1 := value.([]string) - if !ok1 { - _, ok2 := value.([]interface{}) - if !ok2 { - validationResults[index] = false - } - } - case "[]int": - _, ok := value.([]int) - if !ok { - validationResults[index] = false - } - case "[]int64": - _, ok := value.([]int64) - if !ok { - validationResults[index] = false - } - case "[]float32": - _, ok := value.([]float32) - if !ok { - validationResults[index] = false - } - case "[]float64": - _, ok := value.([]float64) - if !ok { - validationResults[index] = false - } - case "[]bool": - _, ok := value.([]bool) - if !ok { - validationResults[index] = false - } - - case "Resource": - _, ok := value.(map[interface{}]interface{}) - if !ok || !valueComplexOk { - validationResults[index] = false - } else { - dataType = "Resource" - } - case "[]Resource": - _, ok := value.([]interface{}) - if !ok || !valueComplexOk { - validationResults[index] = false - } else { - dataType = "[]Resource" - } - case "map[string]string": - _, ok := value.(map[interface{}]interface{}) - if !ok || !valueComplexOk { - validationResults[index] = false - } else { - dataType = "map[string]string" - } - case "map[int]string": - _, ok := value.(map[interface{}]interface{}) - if !ok || !valueComplexOk { - validationResults[index] = false - } else { - dataType = "map[int]string" - } - case "map[string]Resource": - _, ok := value.(map[interface{}]interface{}) - if !ok || !valueComplexOk { - validationResults[index] = false - } else { - dataType = "map[string]Resource" - } - case "map[int]Resource": - _, ok := value.(map[interface{}]interface{}) - if !ok || !valueComplexOk { - validationResults[index] = false - } else { - dataType = "map[int]Resource" - } - } - } - - util.LogDebug(-1, "Properties", "Convoluting global validity") - for _, v := range validationResults { - if v { - util.LogDebug(-1, "Properties", "Found a valid type. Value is valid") - return true, dataType - } - } - - util.LogError(-1, "Properties", "There's no valid type for matching value %s", value) - return false, "" -} - -func validatePropertyTypes(types interface{}, required bool, defaultValue interface{}) ([]string, error) { - var error error - var realTypes []string - - if v, ok := types.(string); ok { - realTypes = []string{v} - } else if v, ok := types.([]string); ok { - realTypes = v - } else { - error = ErrInvalidPropertyTypeObject - return realTypes, error - } - - if len(realTypes) == 0 { - error = ErrUnsetPropertyType - } else if !typesAreValid(&realTypes) { - util.LogError(-1, "Properties", "Error types: %s", realTypes) - error = ErrInvalidPropertyType - } - - return realTypes, error -} diff --git a/vendor/github.com/awslabs/goformation/resources/resource-definition.go b/vendor/github.com/awslabs/goformation/resources/resource-definition.go deleted file mode 100644 index 29d11835b7..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/resource-definition.go +++ /dev/null @@ -1,28 +0,0 @@ -package resources - -// TODO Document -type ResourceDefinition interface { - ResourceType() string - Template(interface{}) Resource - Resource() (Resource, error) - ClassConstructor(input Resource) (Resource, error) -} - -// TODO Document -type LineDictionary interface { - Line() int - Level() int - IndentLevel() int - Key() string - Value() string - Type() string - Parent() LineDictionary - Children() []LineDictionary - End() bool - SetChildren(input []LineDictionary) -} - -// TODO Document -type Scaffoldable interface { - Scaffold(input Resource, propName string) (Resource, error) -} diff --git a/vendor/github.com/awslabs/goformation/resources/resource.go b/vendor/github.com/awslabs/goformation/resources/resource.go deleted file mode 100644 index c58b819268..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/resource.go +++ /dev/null @@ -1,265 +0,0 @@ -package resources - -import ( - "regexp" - - "github.com/awslabs/goformation/util" - "github.com/pkg/errors" -) - -// TODO Document -type EditableResource interface { - Type() string - Properties() map[string]Property - ReturnValues() map[string]string - - Scaffold(name string, data Resource, lines map[string]interface{}) (Resource, []error) -} - -// ErrInvalidResourceType Invalid type assigned to resource -var ErrInvalidResourceType = errors.New("The given resource type is invalid") - -// ErrResourceInvalidPropertyNumber Invalid number of properties on a resource definition -var ErrResourceInvalidPropertyNumber = errors.New("Every resource must have at least one property") - -// ErrUnknownAttributeDefinition Invalid number of properties on a resource definition -var ErrUnknownAttributeDefinition = errors.New("Every resource must have at least one property") - -// ErrInvalidResourceDefinition Invalid definition received for a resource -var ErrInvalidResourceDefinition = errors.New("Resource definition invalid") - -// ErrScaffoldUndefinedType The given data does not define a resource type -var ErrScaffoldUndefinedType = errors.New("The given data does not define a resource type") - -// ErrScaffoldUndefinedProperties The given data does not define any property -var ErrScaffoldUndefinedProperties = errors.New("The given data does not define any property") - -// ErrScaffoldInvalidResourceType Invalid or ungiven type when scaffolding a resource -var ErrScaffoldInvalidResourceType = errors.New("Invalid type given for scaffolding a resource") - -// ErrScaffoldRequiredValueNotSet Required value not set for resource -var ErrScaffoldRequiredValueNotSet = errors.New("Required value not set for resource") - -// newResource Create a new resource with the information given -func newResource(_type string, properties map[string]*property, returnValues map[string]func(Resource) interface{}) (Resource, error) { - - var error error - - error = validateResourceType(_type) - if error != nil { - return nil, error - } - - // Verify that there are properties present - var hasProperties = false - for range properties { - hasProperties = true - } - if !hasProperties { - error = ErrResourceInvalidPropertyNumber - return nil, error - } - - resource := &resource{ - _type: _type, - _properties: properties, - _returnValues: returnValues, - } - - return resource, error -} - -// DefineResource helps quickly defining resources with a raw multi-map -func DefineResource(config map[string]interface{}) (Resource, error) { - util.LogDebug(-1, "Resources", "Starting Resource definition") - - var resource Resource - var error error - - var _type string - var properties map[string]*property - var returnValues map[string]func(Resource) interface{} - - for key, attributes := range config { - - switch key { - case "Type": - _type = attributes.(string) - util.LogDebug(-1, "Resources", "Resource has type %s", _type) - case "Properties": - util.LogDebug(-1, "Resources", "Defining resource's Properties") - properties = nil - unparsedProperties := attributes.(map[string]map[string]interface{}) - properties = make(map[string]*property) - for key, prop := range unparsedProperties { - util.LogDebug(-1, "Resources", "Defining property %s", key) - propInterface, error := DefineProperty(prop) - if error != nil { - util.LogError(-1, "Resources", "Error defining property %s", key) - return nil, error - } - - properties[key] = propInterface.(*property) - } - - case "ReturnValues": - util.LogDebug(-1, "Resources", "Defining Resource's ReturnValues") - returnValues = attributes.(map[string]func(Resource) interface{}) - default: - util.LogError(-1, "Resources", "The Resource has an undefined attribute %s", key) - error = ErrUnknownAttributeDefinition - return nil, error - } - } - - if properties == nil || returnValues == nil { - error = ErrInvalidResourceDefinition - return nil, error - } - - resource, error = newResource(_type, properties, returnValues) - if error != nil { - return nil, error - } - - util.LogDebug(-1, "Resources", "Resource %s defined correctly", _type) - return resource, error -} - -// Begin resource definition - -type resource struct { - _type string - _properties map[string]*property - _returnValues map[string]func(Resource) interface{} - _lines map[string]interface{} -} - -func (r *resource) Type() string { - return r._type -} - -func (r *resource) Properties() map[string]Property { - props := make(map[string]Property) - for key, value := range r._properties { - props[key] = value - } - - return props -} - -func (r *resource) ReturnValues() map[string]string { - return nil -} - -// End resource definition - -func validateResourceType(_type string) error { - switch _type { - case "AWS::Serverless::Function": - fallthrough - case "AWS::Serverless::Api": - fallthrough - case "AWS::Serverless::SimpleTable": - return nil - } - - return ErrInvalidResourceType -} - -var lineExistenceRegex = regexp.MustCompile(`\(line:\s(\d+);\scol:\s(\d+)\)`) - -// Scaffold constructs a new Resource with the given data -func (r *resource) Scaffold(name string, data Resource, lines map[string]interface{}) (Resource, []error) { - var error = []error{} - - resourceType := data.Type() - - util.LogDebug(-1, "Resources", "Starting scaffolding for resource %s", resourceType) - - // Verify that a type is given - if resourceType == "" { - util.LogError(-1, "Resources", "Resource type for resource not given.") - error = append(error, ErrScaffoldUndefinedType) - return nil, error - } - - // Verify that the given type matches with definition's - if resourceType != r._type { - util.LogError(-1, "Resources", "The resource type given - i.e. %s - is different from the resource's - %s", resourceType, r._type) - error = append(error, ErrScaffoldInvalidResourceType) - return nil, error - } - - util.LogDebug(-1, "Resources", "Creating resource") - result := &resource{ - _type: resourceType, - _properties: make(map[string]*property), - _lines: lines, - } - - propLinesRoot := lines["ROOT"].(LineDictionary) - - // Verify that a properties object is given - util.LogDebug(propLinesRoot.Line(), "Resources", "Scaffolding resource's properties (line %d)", propLinesRoot.Line()) - dataProperties := data.Properties() - if dataProperties == nil || len(dataProperties) == 0 { - util.LogError(propLinesRoot.Line(), "Resources", "Properties are not set for resource %s", name) - } - - // Iterate over definition's properties - scaffoldedProperties := make(map[string]*property) - for propName, propDefinition := range r._properties { - util.LogDebug(-1, "Resources", "Scaffolding property %s", propName) - - var propertyLines map[string]interface{} - propertyLinesRaw, propertyLinesRawOk := lines[propName] - if !propertyLinesRawOk { - util.LogDebug(-1, "Resources", "Unable to find line information for property %s", propName) - } else { - propertyLines = propertyLinesRaw.(map[string]interface{}) - } - - prop, err := propDefinition.Scaffold(propName, dataProperties[propName], data, propertyLines) - if err != nil { - util.LogError(propLinesRoot.Line(), "Resources", "There was an error scaffolding property %s", propName) - - errorWrapperString := `Resource "%s", property "%s"` - previousError := err.Error() - - var wrappedError = errors.Wrapf(err, errorWrapperString, name, propName) - if !lineExistenceRegex.MatchString(previousError) { - errorWrapperString += `: ### (line: %d; col: %d)` - wrappedError = errors.Wrapf(err, errorWrapperString, name, propName, propLinesRoot.Line(), propLinesRoot.Level()) - } - - error = append(error, wrappedError) - scaffoldedProperties[propName] = nil - } else { - util.LogDebug(-1, "Resources", "Root Property %s finished scaffolding", propName) - scaffoldedProperties[propName] = prop.(*property) - } - } - - result._properties = scaffoldedProperties - - // Compile return values - returnValues := make(map[string]string) - for returnKey, returnFn := range r._returnValues { - fnResult := returnFn(result) - if fnResult == nil { - util.LogError(-1, "Resources", "The return value %s returns nil", returnKey) - continue - } else if _, ok := fnResult.(string); !ok { - util.LogError(-1, "Resources", "The return value %s does not return a string", returnKey) - continue - } - - resultString := fnResult.(string) - returnValues[returnKey] = resultString - } - - result._returnValues = r._returnValues - - return result, error -} diff --git a/vendor/github.com/awslabs/goformation/resources/safe-processing.go b/vendor/github.com/awslabs/goformation/resources/safe-processing.go deleted file mode 100644 index 1294b9ff3d..0000000000 --- a/vendor/github.com/awslabs/goformation/resources/safe-processing.go +++ /dev/null @@ -1,139 +0,0 @@ -package resources - -import ( - "strconv" - "strings" -) - -func safeProcessInt(prop Property) int { - value := prop.Value() - if value == nil { - return -99999 - } - - if valueInt, valueIntOk := value.(int); valueIntOk { - return valueInt - } else if valueStr, valueStrOk := value.(string); valueStrOk { - ret, error := strconv.ParseInt(valueStr, 10, 32) - if error != nil { - // Something happened - return -99999 - } - - return int(ret) - } - - return value.(int) -} - -func safeProcessString(prop Property) string { - value := prop.Value() - if value == nil { - return "" - } else if _, valueString := value.(string); !valueString { - return "" - } - - return value.(string) -} - -func safeProcessStringArray(prop Property) []string { - value := prop.Value() - - if valueArray, valueArrayOk := value.([]interface{}); valueArrayOk { - ret := make([]string, len(valueArray)) - for pKey, pValue := range valueArray { - ret[pKey] = pValue.(string) - } - - return ret - } - - return []string{} -} - -func safeProcessStringMap(prop Property) map[string]string { - value := prop.Value() - - if valueMap, valueMapOk := value.(map[interface{}]interface{}); valueMapOk { - ret := make(map[string]string) - for pKey, pValue := range valueMap { - var pKeyParsed string - var pValueParsed string - if pKeyPtr, pKeyPtrOk := pKey.(*string); pKeyPtrOk { - pKeyParsed = *pKeyPtr - } else if pKeyStr, pKeyStrOk := pKey.(string); pKeyStrOk { - pKeyParsed = pKeyStr - } - - pValueParsed = "" - if pValueString, pValueStringOk := pValue.(string); pValueStringOk { - pValueParsed = pValueString - } else { - pValueParsed, _ = toStringMaybe(pValue) - } - - ret[pKeyParsed] = pValueParsed - } - - return ret - } - - return map[string]string{} -} - -func safeProcessRaw(prop Property) interface{} { - value := prop.Value() - - switch value.(type) { - case string: - return safeProcessString(prop) - case int: - return safeProcessInt(prop) - case []interface{}: - return safeProcessStringArray(prop) - case map[interface{}]interface{}: - return safeProcessStringMap(prop) - } - - return nil -} - -func safeCastToString(prop Property) string { - value := prop.Value() - - switch value.(type) { - case string: - return value.(string) - case int: - return string(value.(int)) - case []string: - return strings.Join(value.([]string), ", ") - case map[string]string: - var ret = "" - for k, v := range value.(map[string]string) { - ret += k + `: ` + v + `, ` - } - - return ret - } - - return "" -} - -// Converts the input to string if it is a primitive type, Otherwise returns nil -func toStringMaybe(value interface{}) (string, bool) { - - switch value.(type) { - case string: - return value.(string), true - case int: - return strconv.Itoa(value.(int)), true - case float32, float64: - return strconv.FormatFloat(value.(float64), 'f', -1, 64), true - case bool: - return strconv.FormatBool(value.(bool)), true - default: - return "", false - } -} diff --git a/vendor/github.com/awslabs/goformation/scaffold.go b/vendor/github.com/awslabs/goformation/scaffold.go deleted file mode 100644 index be307956f1..0000000000 --- a/vendor/github.com/awslabs/goformation/scaffold.go +++ /dev/null @@ -1,261 +0,0 @@ -package goformation - -import ( - "errors" - "fmt" - - . "github.com/awslabs/goformation/resources" - "github.com/awslabs/goformation/util" -) - -var ( - ErrUnableToReadResourceLineNumbers = errors.New("Failed to read the resources line numbers. This usually means that the template contains invalid indentation. Please check it and try again") - ErrNoResourcesSectionDefined = errors.New("The template does not contain a 'Resources' section") -) - -// TODO Document -func scaffold(input Template) (Template, []error) { - var error = []error{} - - util.LogDebug(-1, "Scaffolding", "Started template scaffolding") - resultUnmarshalledTemplate := input.(*unmarshalledTemplate) - - util.LogDebug(-1, "Scaffolding", "Transforming template types") - resultTemplate := scaffoldFromUnmarshalled(resultUnmarshalledTemplate) - - util.LogDebug(-1, "Scaffolding", "Fetching line numbers") - resultLineNumbers := resultUnmarshalledTemplate._lineNumbers - mappedLineNumbers, err := readResourceLineNumbers(resultLineNumbers) - if err != nil { - util.LogError(-1, "Scaffolding", "Failed to read line number information") - error = append(error, err) - return nil, error - } - - util.LogDebug(-1, "Scaffolding", "Line numbers correctly.") - resourcesLinesRaw, resourcesLinesOk := mappedLineNumbers["Resources"] - if !resourcesLinesOk { - err := errors.New("Template does not contain a Resources section (line: 0; col: 0)") - util.LogError(-1, "Scaffolding", err.Error()) - error = append(error, err) - return nil, error - } - - resourcesLines := resourcesLinesRaw.(map[string]interface{}) - util.LogDebug(-1, "Scaffolding", "Line analysis obtained %d resources", len(resourcesLines)) - - resultingResources := make(map[string]Resource) - allResources := resultTemplate.Resources() - for name, resourceTemplate := range allResources { - linesForResourceRaw, linesForResourceOk := resourcesLines[name] - if !linesForResourceOk { - util.LogError(-1, "Scaffolding", "Unable to retrieve resource line information") - error = append(error, ErrUnableToReadResourceLineNumbers) - return nil, error - } - - linesForResource := linesForResourceRaw.(map[string]interface{}) - util.LogDebug(-1, "Scaffolding", "Fetched lines for resource.") - - parsedResource, error := scaffoldResource(name, resourceTemplate, linesForResource) - if len(error) > 0 { - util.LogError(-1, "Scaffolding", "Error scaffolding resource %s", name) - return nil, error - } - - if parsedResource == nil { - continue - } - - resultingResources[name] = parsedResource - } - - resultTemplate._resources = resultingResources - - return &resultTemplate, nil -} - -func readResourceLineNumbers(obj LineDictionary) (map[string]interface{}, error) { - objValue := obj.Value() - objKey := obj.Key() - - util.LogDebug(-1, "Scaffolding", "Reading lineDictionary key %s", objKey) - children := obj.Children() - ret := make(map[string]interface{}) - - util.LogDebug(-1, "Scaffolding", "Object has %d children", len(children)) - for _, child := range children { - key := child.Key() - value := child.Value() - - util.LogDebug(-1, "Scaffolding", "Getting child %s", value) - - parsedChild, error := readResourceLineNumbers(child) - if error != nil { - util.LogError(-1, "Scaffolding", "Failed getting child %s of lineDictionary %s", value, objValue) - return nil, error - } - - if key != "" { - // TODO Contemplate Array cases. - ret[key] = parsedChild - } else { - ret[value] = parsedChild - } - } - - ret["ROOT"] = obj - - return ret, nil -} - -func scaffoldResource(name string, resourceTemplate Resource, lines map[string]interface{}) (Resource, []error) { - resourceType := resourceTemplate.Type() - rootResourceLinesRaw, rootResourceLinesOk := lines["ROOT"] - if !rootResourceLinesOk { - util.LogError(-1, "Scaffolding", "Lines for resource %s are missing", name) - return nil, []error{ErrUnableToReadResourceLineNumbers} - } - rootResourceLines := rootResourceLinesRaw.(LineDictionary) - - typeLinesRaw, typeLinesRawOk := lines["Type"] - if !typeLinesRawOk { - msg := fmt.Sprintf("Resource %s has no Type set (line: %d; col: %d)", name, rootResourceLines.Line(), rootResourceLines.Level()) - util.LogError(rootResourceLines.Line(), "Scaffolding", msg) - return nil, []error{errors.New(msg)} - } - typeLinesRoot := typeLinesRaw.(map[string]interface{}) - typeLines := typeLinesRoot["ROOT"].(LineDictionary) - - propertiesLinesRaw, propertiesLinesRawOk := lines["Properties"] - propertiesLinesRoot := map[string]interface{}{} - if !propertiesLinesRawOk { - // The resource is missing a Properties section, but that's ok. - propertiesLinesRoot = map[string]interface{}{} - } else { - propertiesLinesRoot = propertiesLinesRaw.(map[string]interface{}) - } - - util.LogDebug(rootResourceLines.Line(), "Scaffolding", "Resource %s (line %d) has type %s", name, rootResourceLines.Line(), resourceType) - factory := GetResourceFactory() - resourceDefinition := factory.GetResourceByType(resourceType) - - if resourceDefinition == nil { - util.LogWarning(typeLines.Line(), "Scaffolding", "The resource %s is not supported (line: %d; col: %d)", name, typeLines.Line(), typeLines.Level()) - return nil, nil - } - - util.LogDebug(-1, "Scaffolding", "Fetched resouce definition for %s", resourceType) - resourceResourceDefinitionBase, err := resourceDefinition.Resource() - if err != nil { - return nil, []error{err} - } - - util.LogDebug(-1, "Scaffolding", "Scaffolding resource %s", name) - resourceInterface := resourceResourceDefinitionBase.(EditableResource) - parsedResource, error := resourceInterface.Scaffold(name, resourceTemplate, propertiesLinesRoot) - if error != nil && len(error) > 0 { - return nil, error - } - - util.LogDebug(-1, "Scaffolding", "Resource %s scaffolded", name) - - return parsedResource, nil -} - -func scaffoldFromUnmarshalled(input Template) scaffoldedTemplate { - template := scaffoldedTemplate{ - _version: input.Version(), - _transform: input.Transform(), - _parameters: input.Parameters(), - _outputs: input.Outputs(), - _resources: make(map[string]Resource), - } - - for key, res := range input.Resources() { - scaffResource := &scaffoldedResource{ - _properties: make(map[string]*scaffoldedProperty), - _type: res.Type(), - } - - for p, prop := range res.Properties() { - if prop == nil { - continue - } - - scaffResource._properties[p] = &scaffoldedProperty{ - _value: prop.Original(), - } - } - - template._resources[key] = scaffResource - } - - return template -} - -type scaffoldedTemplate struct { - _version string - _transform []string - _parameters map[string]Parameter - _resources map[string]Resource - _outputs map[string]Output - _lineNumbers LineDictionary -} - -func (t *scaffoldedTemplate) Version() string { - return t._version -} -func (t *scaffoldedTemplate) Transform() []string { - return t._transform -} -func (t *scaffoldedTemplate) Parameters() map[string]Parameter { - return t._parameters -} -func (t *scaffoldedTemplate) Resources() map[string]Resource { - return t._resources -} -func (t *scaffoldedTemplate) Outputs() map[string]Output { - return t._outputs -} - -func (t *scaffoldedTemplate) GetResourcesByType(resourceType string) map[string]Resource { - return nil -} - -type scaffoldedResource struct { - _type string - _properties map[string]*scaffoldedProperty - _lineNumber int -} - -func (r *scaffoldedResource) Type() string { - return r._type -} - -func (r *scaffoldedResource) Properties() map[string]Property { - props := make(map[string]Property) - for key, value := range r._properties { - setPropertyKey(props, key, value) - } - return props -} - -func (r *scaffoldedResource) ReturnValues() map[string]string { - return nil -} - -type scaffoldedProperty struct { - _value interface{} - lineNumber int -} - -func (p *scaffoldedProperty) Value() interface{} { - return nil -} -func (p *scaffoldedProperty) Original() interface{} { - return p._value -} -func (p *scaffoldedProperty) HasFn() bool { - return false -} diff --git a/vendor/github.com/awslabs/goformation/schema/README.md b/vendor/github.com/awslabs/goformation/schema/README.md new file mode 100644 index 0000000000..64136ad107 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/schema/README.md @@ -0,0 +1,5 @@ +### Important + +The JSON Schema in this directory is auto-generated by running 'go generate' in the repository root directory. + +Do not manually edit it. \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/schema/cloudformation.schema.json b/vendor/github.com/awslabs/goformation/schema/cloudformation.schema.json new file mode 100644 index 0000000000..c9e6cb5e9b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/schema/cloudformation.schema.json @@ -0,0 +1,14093 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "definitions": { + "AWS::ApiGateway::Account": { + "properties": { + "CloudWatchRoleArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::ApiKey": { + "properties": { + "Description": { + "type": "string" + }, + "Enabled": { + "type": "boolean" + }, + "Name": { + "type": "string" + }, + "StageKeys": { + "items": { + "$ref": "#/definitions/AWS::ApiGateway::ApiKey.StageKey" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::ApiGateway::ApiKey.StageKey": { + "properties": { + "RestApiId": { + "type": "string" + }, + "StageName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::Authorizer": { + "properties": { + "AuthorizerCredentials": { + "type": "string" + }, + "AuthorizerResultTtlInSeconds": { + "type": "number" + }, + "AuthorizerUri": { + "type": "string" + }, + "IdentitySource": { + "type": "string" + }, + "IdentityValidationExpression": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "ProviderARNs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "RestApiId": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::BasePathMapping": { + "properties": { + "BasePath": { + "type": "string" + }, + "DomainName": { + "type": "string" + }, + "RestApiId": { + "type": "string" + }, + "Stage": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::ClientCertificate": { + "properties": { + "Description": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::Deployment": { + "properties": { + "Description": { + "type": "string" + }, + "RestApiId": { + "type": "string" + }, + "StageDescription": { + "$ref": "#/definitions/AWS::ApiGateway::Deployment.StageDescription" + }, + "StageName": { + "type": "string" + } + }, + "required": [ + "RestApiId" + ], + "type": "object" + }, + "AWS::ApiGateway::Deployment.MethodSetting": { + "properties": { + "CacheDataEncrypted": { + "type": "boolean" + }, + "CacheTtlInSeconds": { + "type": "number" + }, + "CachingEnabled": { + "type": "boolean" + }, + "DataTraceEnabled": { + "type": "boolean" + }, + "HttpMethod": { + "type": "string" + }, + "LoggingLevel": { + "type": "string" + }, + "MetricsEnabled": { + "type": "boolean" + }, + "ResourcePath": { + "type": "string" + }, + "ThrottlingBurstLimit": { + "type": "number" + }, + "ThrottlingRateLimit": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::ApiGateway::Deployment.StageDescription": { + "properties": { + "CacheClusterEnabled": { + "type": "boolean" + }, + "CacheClusterSize": { + "type": "string" + }, + "CacheDataEncrypted": { + "type": "boolean" + }, + "CacheTtlInSeconds": { + "type": "number" + }, + "CachingEnabled": { + "type": "boolean" + }, + "ClientCertificateId": { + "type": "string" + }, + "DataTraceEnabled": { + "type": "boolean" + }, + "Description": { + "type": "string" + }, + "LoggingLevel": { + "type": "string" + }, + "MethodSettings": { + "items": { + "$ref": "#/definitions/AWS::ApiGateway::Deployment.MethodSetting" + }, + "type": "array" + }, + "MetricsEnabled": { + "type": "boolean" + }, + "StageName": { + "type": "string" + }, + "ThrottlingBurstLimit": { + "type": "number" + }, + "ThrottlingRateLimit": { + "type": "number" + }, + "Variables": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "AWS::ApiGateway::DomainName": { + "properties": { + "CertificateArn": { + "type": "string" + }, + "DomainName": { + "type": "string" + } + }, + "required": [ + "CertificateArn", + "DomainName" + ], + "type": "object" + }, + "AWS::ApiGateway::Method": { + "properties": { + "ApiKeyRequired": { + "type": "boolean" + }, + "AuthorizationType": { + "type": "string" + }, + "AuthorizerId": { + "type": "string" + }, + "HttpMethod": { + "type": "string" + }, + "Integration": { + "$ref": "#/definitions/AWS::ApiGateway::Method.Integration" + }, + "MethodResponses": { + "items": { + "$ref": "#/definitions/AWS::ApiGateway::Method.MethodResponse" + }, + "type": "array" + }, + "RequestModels": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "RequestParameters": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "boolean" + } + }, + "type": "object" + }, + "ResourceId": { + "type": "string" + }, + "RestApiId": { + "type": "string" + } + }, + "required": [ + "HttpMethod" + ], + "type": "object" + }, + "AWS::ApiGateway::Method.Integration": { + "properties": { + "CacheKeyParameters": { + "items": { + "type": "string" + }, + "type": "array" + }, + "CacheNamespace": { + "type": "string" + }, + "Credentials": { + "type": "string" + }, + "IntegrationHttpMethod": { + "type": "string" + }, + "IntegrationResponses": { + "items": { + "$ref": "#/definitions/AWS::ApiGateway::Method.IntegrationResponse" + }, + "type": "array" + }, + "PassthroughBehavior": { + "type": "string" + }, + "RequestParameters": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "RequestTemplates": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Type": { + "type": "string" + }, + "Uri": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::Method.IntegrationResponse": { + "properties": { + "ResponseParameters": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "ResponseTemplates": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "SelectionPattern": { + "type": "string" + }, + "StatusCode": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::Method.MethodResponse": { + "properties": { + "ResponseModels": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "ResponseParameters": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "boolean" + } + }, + "type": "object" + }, + "StatusCode": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::Model": { + "properties": { + "ContentType": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "RestApiId": { + "type": "string" + }, + "Schema": { + "type": "object" + } + }, + "required": [ + "RestApiId" + ], + "type": "object" + }, + "AWS::ApiGateway::Resource": { + "properties": { + "ParentId": { + "type": "string" + }, + "PathPart": { + "type": "string" + }, + "RestApiId": { + "type": "string" + } + }, + "required": [ + "ParentId", + "PathPart", + "RestApiId" + ], + "type": "object" + }, + "AWS::ApiGateway::RestApi": { + "properties": { + "BinaryMediaTypes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Body": { + "type": "object" + }, + "BodyS3Location": { + "$ref": "#/definitions/AWS::ApiGateway::RestApi.S3Location" + }, + "CloneFrom": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "FailOnWarnings": { + "type": "boolean" + }, + "Mode": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Parameters": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "AWS::ApiGateway::RestApi.S3Location": { + "properties": { + "Bucket": { + "type": "string" + }, + "ETag": { + "type": "string" + }, + "Key": { + "type": "string" + }, + "Version": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::Stage": { + "properties": { + "CacheClusterEnabled": { + "type": "boolean" + }, + "CacheClusterSize": { + "type": "string" + }, + "ClientCertificateId": { + "type": "string" + }, + "DeploymentId": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "MethodSettings": { + "items": { + "$ref": "#/definitions/AWS::ApiGateway::Stage.MethodSetting" + }, + "type": "array" + }, + "RestApiId": { + "type": "string" + }, + "StageName": { + "type": "string" + }, + "Variables": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "AWS::ApiGateway::Stage.MethodSetting": { + "properties": { + "CacheDataEncrypted": { + "type": "boolean" + }, + "CacheTtlInSeconds": { + "type": "number" + }, + "CachingEnabled": { + "type": "boolean" + }, + "DataTraceEnabled": { + "type": "boolean" + }, + "HttpMethod": { + "type": "string" + }, + "LoggingLevel": { + "type": "string" + }, + "MetricsEnabled": { + "type": "boolean" + }, + "ResourcePath": { + "type": "string" + }, + "ThrottlingBurstLimit": { + "type": "number" + }, + "ThrottlingRateLimit": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::ApiGateway::UsagePlan": { + "properties": { + "ApiStages": { + "items": { + "$ref": "#/definitions/AWS::ApiGateway::UsagePlan.ApiStage" + }, + "type": "array" + }, + "Description": { + "type": "string" + }, + "Quota": { + "$ref": "#/definitions/AWS::ApiGateway::UsagePlan.QuotaSettings" + }, + "Throttle": { + "$ref": "#/definitions/AWS::ApiGateway::UsagePlan.ThrottleSettings" + }, + "UsagePlanName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::UsagePlan.ApiStage": { + "properties": { + "ApiId": { + "type": "string" + }, + "Stage": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::UsagePlan.QuotaSettings": { + "properties": { + "Limit": { + "type": "number" + }, + "Offset": { + "type": "number" + }, + "Period": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ApiGateway::UsagePlan.ThrottleSettings": { + "properties": { + "BurstLimit": { + "type": "number" + }, + "RateLimit": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::ApiGateway::UsagePlanKey": { + "properties": { + "KeyId": { + "type": "string" + }, + "KeyType": { + "type": "string" + }, + "UsagePlanId": { + "type": "string" + } + }, + "required": [ + "KeyId", + "KeyType", + "UsagePlanId" + ], + "type": "object" + }, + "AWS::ApplicationAutoScaling::ScalableTarget": { + "properties": { + "MaxCapacity": { + "type": "number" + }, + "MinCapacity": { + "type": "number" + }, + "ResourceId": { + "type": "string" + }, + "RoleARN": { + "type": "string" + }, + "ScalableDimension": { + "type": "string" + }, + "ServiceNamespace": { + "type": "string" + } + }, + "required": [ + "MaxCapacity", + "MinCapacity", + "ResourceId", + "RoleARN", + "ScalableDimension", + "ServiceNamespace" + ], + "type": "object" + }, + "AWS::ApplicationAutoScaling::ScalingPolicy": { + "properties": { + "PolicyName": { + "type": "string" + }, + "PolicyType": { + "type": "string" + }, + "ResourceId": { + "type": "string" + }, + "ScalableDimension": { + "type": "string" + }, + "ScalingTargetId": { + "type": "string" + }, + "ServiceNamespace": { + "type": "string" + }, + "StepScalingPolicyConfiguration": { + "$ref": "#/definitions/AWS::ApplicationAutoScaling::ScalingPolicy.StepScalingPolicyConfiguration" + }, + "TargetTrackingScalingPolicyConfiguration": { + "$ref": "#/definitions/AWS::ApplicationAutoScaling::ScalingPolicy.TargetTrackingScalingPolicyConfiguration" + } + }, + "required": [ + "PolicyName", + "PolicyType" + ], + "type": "object" + }, + "AWS::ApplicationAutoScaling::ScalingPolicy.CustomizedMetricSpecification": { + "properties": { + "Dimensions": { + "items": { + "$ref": "#/definitions/AWS::ApplicationAutoScaling::ScalingPolicy.MetricDimension" + }, + "type": "array" + }, + "MetricName": { + "type": "string" + }, + "Namespace": { + "type": "string" + }, + "Statistic": { + "type": "string" + }, + "Unit": { + "type": "string" + } + }, + "required": [ + "MetricName", + "Namespace", + "Statistic" + ], + "type": "object" + }, + "AWS::ApplicationAutoScaling::ScalingPolicy.MetricDimension": { + "properties": { + "Name": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Name", + "Value" + ], + "type": "object" + }, + "AWS::ApplicationAutoScaling::ScalingPolicy.PredefinedMetricSpecification": { + "properties": { + "PredefinedMetricType": { + "type": "string" + }, + "ResourceLabel": { + "type": "string" + } + }, + "required": [ + "PredefinedMetricType" + ], + "type": "object" + }, + "AWS::ApplicationAutoScaling::ScalingPolicy.StepAdjustment": { + "properties": { + "MetricIntervalLowerBound": { + "type": "number" + }, + "MetricIntervalUpperBound": { + "type": "number" + }, + "ScalingAdjustment": { + "type": "number" + } + }, + "required": [ + "ScalingAdjustment" + ], + "type": "object" + }, + "AWS::ApplicationAutoScaling::ScalingPolicy.StepScalingPolicyConfiguration": { + "properties": { + "AdjustmentType": { + "type": "string" + }, + "Cooldown": { + "type": "number" + }, + "MetricAggregationType": { + "type": "string" + }, + "MinAdjustmentMagnitude": { + "type": "number" + }, + "StepAdjustments": { + "items": { + "$ref": "#/definitions/AWS::ApplicationAutoScaling::ScalingPolicy.StepAdjustment" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::ApplicationAutoScaling::ScalingPolicy.TargetTrackingScalingPolicyConfiguration": { + "properties": { + "CustomizedMetricSpecification": { + "$ref": "#/definitions/AWS::ApplicationAutoScaling::ScalingPolicy.CustomizedMetricSpecification" + }, + "PredefinedMetricSpecification": { + "$ref": "#/definitions/AWS::ApplicationAutoScaling::ScalingPolicy.PredefinedMetricSpecification" + }, + "ScaleInCooldown": { + "type": "number" + }, + "ScaleOutCooldown": { + "type": "number" + }, + "TargetValue": { + "type": "number" + } + }, + "required": [ + "TargetValue" + ], + "type": "object" + }, + "AWS::AutoScaling::AutoScalingGroup": { + "properties": { + "AvailabilityZones": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Cooldown": { + "type": "string" + }, + "DesiredCapacity": { + "type": "string" + }, + "HealthCheckGracePeriod": { + "type": "number" + }, + "HealthCheckType": { + "type": "string" + }, + "InstanceId": { + "type": "string" + }, + "LaunchConfigurationName": { + "type": "string" + }, + "LoadBalancerNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "MaxSize": { + "type": "string" + }, + "MetricsCollection": { + "items": { + "$ref": "#/definitions/AWS::AutoScaling::AutoScalingGroup.MetricsCollection" + }, + "type": "array" + }, + "MinSize": { + "type": "string" + }, + "NotificationConfigurations": { + "items": { + "$ref": "#/definitions/AWS::AutoScaling::AutoScalingGroup.NotificationConfiguration" + }, + "type": "array" + }, + "PlacementGroup": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/AWS::AutoScaling::AutoScalingGroup.TagProperty" + }, + "type": "array" + }, + "TargetGroupARNs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "TerminationPolicies": { + "items": { + "type": "string" + }, + "type": "array" + }, + "VPCZoneIdentifier": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "MaxSize", + "MinSize" + ], + "type": "object" + }, + "AWS::AutoScaling::AutoScalingGroup.MetricsCollection": { + "properties": { + "Granularity": { + "type": "string" + }, + "Metrics": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "Granularity" + ], + "type": "object" + }, + "AWS::AutoScaling::AutoScalingGroup.NotificationConfiguration": { + "properties": { + "NotificationTypes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "TopicARN": { + "type": "string" + } + }, + "required": [ + "TopicARN" + ], + "type": "object" + }, + "AWS::AutoScaling::AutoScalingGroup.TagProperty": { + "properties": { + "Key": { + "type": "string" + }, + "PropagateAtLaunch": { + "type": "boolean" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "PropagateAtLaunch", + "Value" + ], + "type": "object" + }, + "AWS::AutoScaling::LaunchConfiguration": { + "properties": { + "AssociatePublicIpAddress": { + "type": "boolean" + }, + "BlockDeviceMappings": { + "items": { + "$ref": "#/definitions/AWS::AutoScaling::LaunchConfiguration.BlockDeviceMapping" + }, + "type": "array" + }, + "ClassicLinkVPCId": { + "type": "string" + }, + "ClassicLinkVPCSecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "EbsOptimized": { + "type": "boolean" + }, + "IamInstanceProfile": { + "type": "string" + }, + "ImageId": { + "type": "string" + }, + "InstanceId": { + "type": "string" + }, + "InstanceMonitoring": { + "type": "boolean" + }, + "InstanceType": { + "type": "string" + }, + "KernelId": { + "type": "string" + }, + "KeyName": { + "type": "string" + }, + "PlacementTenancy": { + "type": "string" + }, + "RamDiskId": { + "type": "string" + }, + "SecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SpotPrice": { + "type": "string" + }, + "UserData": { + "type": "string" + } + }, + "required": [ + "ImageId", + "InstanceType" + ], + "type": "object" + }, + "AWS::AutoScaling::LaunchConfiguration.BlockDevice": { + "properties": { + "DeleteOnTermination": { + "type": "boolean" + }, + "Encrypted": { + "type": "boolean" + }, + "Iops": { + "type": "number" + }, + "SnapshotId": { + "type": "string" + }, + "VolumeSize": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::AutoScaling::LaunchConfiguration.BlockDeviceMapping": { + "properties": { + "DeviceName": { + "type": "string" + }, + "Ebs": { + "$ref": "#/definitions/AWS::AutoScaling::LaunchConfiguration.BlockDevice" + }, + "NoDevice": { + "type": "boolean" + }, + "VirtualName": { + "type": "string" + } + }, + "required": [ + "DeviceName" + ], + "type": "object" + }, + "AWS::AutoScaling::LifecycleHook": { + "properties": { + "AutoScalingGroupName": { + "type": "string" + }, + "DefaultResult": { + "type": "string" + }, + "HeartbeatTimeout": { + "type": "number" + }, + "LifecycleTransition": { + "type": "string" + }, + "NotificationMetadata": { + "type": "string" + }, + "NotificationTargetARN": { + "type": "string" + }, + "RoleARN": { + "type": "string" + } + }, + "required": [ + "AutoScalingGroupName", + "LifecycleTransition" + ], + "type": "object" + }, + "AWS::AutoScaling::ScalingPolicy": { + "properties": { + "AdjustmentType": { + "type": "string" + }, + "AutoScalingGroupName": { + "type": "string" + }, + "Cooldown": { + "type": "string" + }, + "EstimatedInstanceWarmup": { + "type": "number" + }, + "MetricAggregationType": { + "type": "string" + }, + "MinAdjustmentMagnitude": { + "type": "number" + }, + "PolicyType": { + "type": "string" + }, + "ScalingAdjustment": { + "type": "number" + }, + "StepAdjustments": { + "items": { + "$ref": "#/definitions/AWS::AutoScaling::ScalingPolicy.StepAdjustment" + }, + "type": "array" + } + }, + "required": [ + "AdjustmentType", + "AutoScalingGroupName" + ], + "type": "object" + }, + "AWS::AutoScaling::ScalingPolicy.StepAdjustment": { + "properties": { + "MetricIntervalLowerBound": { + "type": "number" + }, + "MetricIntervalUpperBound": { + "type": "number" + }, + "ScalingAdjustment": { + "type": "number" + } + }, + "required": [ + "ScalingAdjustment" + ], + "type": "object" + }, + "AWS::AutoScaling::ScheduledAction": { + "properties": { + "AutoScalingGroupName": { + "type": "string" + }, + "DesiredCapacity": { + "type": "number" + }, + "EndTime": { + "type": "string" + }, + "MaxSize": { + "type": "number" + }, + "MinSize": { + "type": "number" + }, + "Recurrence": { + "type": "string" + }, + "StartTime": { + "type": "string" + } + }, + "required": [ + "AutoScalingGroupName" + ], + "type": "object" + }, + "AWS::Batch::ComputeEnvironment": { + "properties": { + "ComputeEnvironmentName": { + "type": "string" + }, + "ComputeResources": { + "$ref": "#/definitions/AWS::Batch::ComputeEnvironment.ComputeResources" + }, + "ServiceRole": { + "type": "string" + }, + "State": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "ComputeResources", + "ServiceRole", + "Type" + ], + "type": "object" + }, + "AWS::Batch::ComputeEnvironment.ComputeResources": { + "properties": { + "BidPercentage": { + "type": "number" + }, + "DesiredvCpus": { + "type": "number" + }, + "Ec2KeyPair": { + "type": "string" + }, + "ImageId": { + "type": "string" + }, + "InstanceRole": { + "type": "string" + }, + "InstanceTypes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "MaxvCpus": { + "type": "number" + }, + "MinvCpus": { + "type": "number" + }, + "SecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SpotIamFleetRole": { + "type": "string" + }, + "Subnets": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Tags": { + "type": "object" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "InstanceRole", + "InstanceTypes", + "MaxvCpus", + "MinvCpus", + "SecurityGroupIds", + "Subnets", + "Type" + ], + "type": "object" + }, + "AWS::Batch::JobDefinition": { + "properties": { + "ContainerProperties": { + "$ref": "#/definitions/AWS::Batch::JobDefinition.ContainerProperties" + }, + "JobDefinitionName": { + "type": "string" + }, + "Parameters": { + "type": "object" + }, + "RetryStrategy": { + "$ref": "#/definitions/AWS::Batch::JobDefinition.RetryStrategy" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "ContainerProperties", + "Type" + ], + "type": "object" + }, + "AWS::Batch::JobDefinition.ContainerProperties": { + "properties": { + "Command": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Environment": { + "items": { + "$ref": "#/definitions/AWS::Batch::JobDefinition.Environment" + }, + "type": "array" + }, + "Image": { + "type": "string" + }, + "JobRoleArn": { + "type": "string" + }, + "Memory": { + "type": "number" + }, + "MountPoints": { + "items": { + "$ref": "#/definitions/AWS::Batch::JobDefinition.MountPoints" + }, + "type": "array" + }, + "Privileged": { + "type": "boolean" + }, + "ReadonlyRootFilesystem": { + "type": "boolean" + }, + "Ulimits": { + "items": { + "$ref": "#/definitions/AWS::Batch::JobDefinition.Ulimit" + }, + "type": "array" + }, + "User": { + "type": "string" + }, + "Vcpus": { + "type": "number" + }, + "Volumes": { + "items": { + "$ref": "#/definitions/AWS::Batch::JobDefinition.Volumes" + }, + "type": "array" + } + }, + "required": [ + "Image", + "Memory", + "Vcpus" + ], + "type": "object" + }, + "AWS::Batch::JobDefinition.Environment": { + "properties": { + "Name": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Batch::JobDefinition.MountPoints": { + "properties": { + "ContainerPath": { + "type": "string" + }, + "ReadOnly": { + "type": "boolean" + }, + "SourceVolume": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Batch::JobDefinition.RetryStrategy": { + "properties": { + "Attempts": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::Batch::JobDefinition.Ulimit": { + "properties": { + "HardLimit": { + "type": "number" + }, + "Name": { + "type": "string" + }, + "SoftLimit": { + "type": "number" + } + }, + "required": [ + "HardLimit", + "Name", + "SoftLimit" + ], + "type": "object" + }, + "AWS::Batch::JobDefinition.Volumes": { + "properties": { + "Host": { + "$ref": "#/definitions/AWS::Batch::JobDefinition.VolumesHost" + }, + "Name": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Batch::JobDefinition.VolumesHost": { + "properties": { + "SourcePath": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Batch::JobQueue": { + "properties": { + "ComputeEnvironmentOrder": { + "items": { + "$ref": "#/definitions/AWS::Batch::JobQueue.ComputeEnvironmentOrder" + }, + "type": "array" + }, + "JobQueueName": { + "type": "string" + }, + "Priority": { + "type": "number" + }, + "State": { + "type": "string" + } + }, + "required": [ + "ComputeEnvironmentOrder", + "Priority" + ], + "type": "object" + }, + "AWS::Batch::JobQueue.ComputeEnvironmentOrder": { + "properties": { + "ComputeEnvironment": { + "type": "string" + }, + "Order": { + "type": "number" + } + }, + "required": [ + "ComputeEnvironment", + "Order" + ], + "type": "object" + }, + "AWS::CertificateManager::Certificate": { + "properties": { + "DomainName": { + "type": "string" + }, + "DomainValidationOptions": { + "items": { + "$ref": "#/definitions/AWS::CertificateManager::Certificate.DomainValidationOption" + }, + "type": "array" + }, + "SubjectAlternativeNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "DomainName" + ], + "type": "object" + }, + "AWS::CertificateManager::Certificate.DomainValidationOption": { + "properties": { + "DomainName": { + "type": "string" + }, + "ValidationDomain": { + "type": "string" + } + }, + "required": [ + "DomainName", + "ValidationDomain" + ], + "type": "object" + }, + "AWS::CloudFormation::CustomResource": { + "properties": { + "ServiceToken": { + "type": "string" + } + }, + "required": [ + "ServiceToken" + ], + "type": "object" + }, + "AWS::CloudFormation::Stack": { + "properties": { + "NotificationARNs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Parameters": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "TemplateURL": { + "type": "string" + }, + "TimeoutInMinutes": { + "type": "number" + } + }, + "required": [ + "TemplateURL" + ], + "type": "object" + }, + "AWS::CloudFormation::WaitCondition": { + "properties": { + "Count": { + "type": "number" + }, + "Handle": { + "type": "string" + }, + "Timeout": { + "type": "string" + } + }, + "required": [ + "Handle", + "Timeout" + ], + "type": "object" + }, + "AWS::CloudFormation::WaitConditionHandle": { + "properties": {}, + "type": "object" + }, + "AWS::CloudFront::Distribution": { + "properties": { + "DistributionConfig": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.DistributionConfig" + } + }, + "required": [ + "DistributionConfig" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.CacheBehavior": { + "properties": { + "AllowedMethods": { + "items": { + "type": "string" + }, + "type": "array" + }, + "CachedMethods": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Compress": { + "type": "boolean" + }, + "DefaultTTL": { + "type": "number" + }, + "ForwardedValues": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.ForwardedValues" + }, + "MaxTTL": { + "type": "number" + }, + "MinTTL": { + "type": "number" + }, + "PathPattern": { + "type": "string" + }, + "SmoothStreaming": { + "type": "boolean" + }, + "TargetOriginId": { + "type": "string" + }, + "TrustedSigners": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ViewerProtocolPolicy": { + "type": "string" + } + }, + "required": [ + "ForwardedValues", + "PathPattern", + "TargetOriginId", + "ViewerProtocolPolicy" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.Cookies": { + "properties": { + "Forward": { + "type": "string" + }, + "WhitelistedNames": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "Forward" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.CustomErrorResponse": { + "properties": { + "ErrorCachingMinTTL": { + "type": "number" + }, + "ErrorCode": { + "type": "number" + }, + "ResponseCode": { + "type": "number" + }, + "ResponsePagePath": { + "type": "string" + } + }, + "required": [ + "ErrorCode" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.CustomOriginConfig": { + "properties": { + "HTTPPort": { + "type": "number" + }, + "HTTPSPort": { + "type": "number" + }, + "OriginProtocolPolicy": { + "type": "string" + }, + "OriginSSLProtocols": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "OriginProtocolPolicy" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.DefaultCacheBehavior": { + "properties": { + "AllowedMethods": { + "items": { + "type": "string" + }, + "type": "array" + }, + "CachedMethods": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Compress": { + "type": "boolean" + }, + "DefaultTTL": { + "type": "number" + }, + "ForwardedValues": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.ForwardedValues" + }, + "MaxTTL": { + "type": "number" + }, + "MinTTL": { + "type": "number" + }, + "SmoothStreaming": { + "type": "boolean" + }, + "TargetOriginId": { + "type": "string" + }, + "TrustedSigners": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ViewerProtocolPolicy": { + "type": "string" + } + }, + "required": [ + "ForwardedValues", + "TargetOriginId", + "ViewerProtocolPolicy" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.DistributionConfig": { + "properties": { + "Aliases": { + "items": { + "type": "string" + }, + "type": "array" + }, + "CacheBehaviors": { + "items": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.CacheBehavior" + }, + "type": "array" + }, + "Comment": { + "type": "string" + }, + "CustomErrorResponses": { + "items": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.CustomErrorResponse" + }, + "type": "array" + }, + "DefaultCacheBehavior": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.DefaultCacheBehavior" + }, + "DefaultRootObject": { + "type": "string" + }, + "Enabled": { + "type": "boolean" + }, + "HttpVersion": { + "type": "string" + }, + "Logging": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.Logging" + }, + "Origins": { + "items": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.Origin" + }, + "type": "array" + }, + "PriceClass": { + "type": "string" + }, + "Restrictions": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.Restrictions" + }, + "ViewerCertificate": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.ViewerCertificate" + }, + "WebACLId": { + "type": "string" + } + }, + "required": [ + "DefaultCacheBehavior", + "Enabled", + "Origins" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.ForwardedValues": { + "properties": { + "Cookies": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.Cookies" + }, + "Headers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "QueryString": { + "type": "boolean" + }, + "QueryStringCacheKeys": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "QueryString" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.GeoRestriction": { + "properties": { + "Locations": { + "items": { + "type": "string" + }, + "type": "array" + }, + "RestrictionType": { + "type": "string" + } + }, + "required": [ + "RestrictionType" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.Logging": { + "properties": { + "Bucket": { + "type": "string" + }, + "IncludeCookies": { + "type": "boolean" + }, + "Prefix": { + "type": "string" + } + }, + "required": [ + "Bucket" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.Origin": { + "properties": { + "CustomOriginConfig": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.CustomOriginConfig" + }, + "DomainName": { + "type": "string" + }, + "Id": { + "type": "string" + }, + "OriginCustomHeaders": { + "items": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.OriginCustomHeader" + }, + "type": "array" + }, + "OriginPath": { + "type": "string" + }, + "S3OriginConfig": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.S3OriginConfig" + } + }, + "required": [ + "DomainName", + "Id" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.OriginCustomHeader": { + "properties": { + "HeaderName": { + "type": "string" + }, + "HeaderValue": { + "type": "string" + } + }, + "required": [ + "HeaderName", + "HeaderValue" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.Restrictions": { + "properties": { + "GeoRestriction": { + "$ref": "#/definitions/AWS::CloudFront::Distribution.GeoRestriction" + } + }, + "required": [ + "GeoRestriction" + ], + "type": "object" + }, + "AWS::CloudFront::Distribution.S3OriginConfig": { + "properties": { + "OriginAccessIdentity": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CloudFront::Distribution.ViewerCertificate": { + "properties": { + "AcmCertificateArn": { + "type": "string" + }, + "CloudFrontDefaultCertificate": { + "type": "boolean" + }, + "IamCertificateId": { + "type": "string" + }, + "MinimumProtocolVersion": { + "type": "string" + }, + "SslSupportMethod": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CloudTrail::Trail": { + "properties": { + "CloudWatchLogsLogGroupArn": { + "type": "string" + }, + "CloudWatchLogsRoleArn": { + "type": "string" + }, + "EnableLogFileValidation": { + "type": "boolean" + }, + "IncludeGlobalServiceEvents": { + "type": "boolean" + }, + "IsLogging": { + "type": "boolean" + }, + "IsMultiRegionTrail": { + "type": "boolean" + }, + "KMSKeyId": { + "type": "string" + }, + "S3BucketName": { + "type": "string" + }, + "S3KeyPrefix": { + "type": "string" + }, + "SnsTopicName": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "TrailName": { + "type": "string" + } + }, + "required": [ + "IsLogging", + "S3BucketName" + ], + "type": "object" + }, + "AWS::CloudWatch::Alarm": { + "properties": { + "ActionsEnabled": { + "type": "boolean" + }, + "AlarmActions": { + "items": { + "type": "string" + }, + "type": "array" + }, + "AlarmDescription": { + "type": "string" + }, + "AlarmName": { + "type": "string" + }, + "ComparisonOperator": { + "type": "string" + }, + "Dimensions": { + "items": { + "$ref": "#/definitions/AWS::CloudWatch::Alarm.Dimension" + }, + "type": "array" + }, + "EvaluateLowSampleCountPercentile": { + "type": "string" + }, + "EvaluationPeriods": { + "type": "number" + }, + "ExtendedStatistic": { + "type": "string" + }, + "InsufficientDataActions": { + "items": { + "type": "string" + }, + "type": "array" + }, + "MetricName": { + "type": "string" + }, + "Namespace": { + "type": "string" + }, + "OKActions": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Period": { + "type": "number" + }, + "Statistic": { + "type": "string" + }, + "Threshold": { + "type": "number" + }, + "TreatMissingData": { + "type": "string" + }, + "Unit": { + "type": "string" + } + }, + "required": [ + "ComparisonOperator", + "EvaluationPeriods", + "MetricName", + "Namespace", + "Period", + "Threshold" + ], + "type": "object" + }, + "AWS::CloudWatch::Alarm.Dimension": { + "properties": { + "Name": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Name", + "Value" + ], + "type": "object" + }, + "AWS::CloudWatch::Dashboard": { + "properties": { + "DashboardBody": { + "type": "string" + }, + "DashboardName": { + "type": "string" + } + }, + "required": [ + "DashboardBody" + ], + "type": "object" + }, + "AWS::CodeBuild::Project": { + "properties": { + "Artifacts": { + "$ref": "#/definitions/AWS::CodeBuild::Project.Artifacts" + }, + "Description": { + "type": "string" + }, + "EncryptionKey": { + "type": "string" + }, + "Environment": { + "$ref": "#/definitions/AWS::CodeBuild::Project.Environment" + }, + "Name": { + "type": "string" + }, + "ServiceRole": { + "type": "string" + }, + "Source": { + "$ref": "#/definitions/AWS::CodeBuild::Project.Source" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "TimeoutInMinutes": { + "type": "number" + } + }, + "required": [ + "Artifacts", + "Environment", + "ServiceRole", + "Source" + ], + "type": "object" + }, + "AWS::CodeBuild::Project.Artifacts": { + "properties": { + "Location": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "NamespaceType": { + "type": "string" + }, + "Packaging": { + "type": "string" + }, + "Path": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::CodeBuild::Project.Environment": { + "properties": { + "ComputeType": { + "type": "string" + }, + "EnvironmentVariables": { + "items": { + "$ref": "#/definitions/AWS::CodeBuild::Project.EnvironmentVariable" + }, + "type": "array" + }, + "Image": { + "type": "string" + }, + "PrivilegedMode": { + "type": "boolean" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "ComputeType", + "Image", + "Type" + ], + "type": "object" + }, + "AWS::CodeBuild::Project.EnvironmentVariable": { + "properties": { + "Name": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Name", + "Value" + ], + "type": "object" + }, + "AWS::CodeBuild::Project.Source": { + "properties": { + "Auth": { + "$ref": "#/definitions/AWS::CodeBuild::Project.SourceAuth" + }, + "BuildSpec": { + "type": "string" + }, + "Location": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::CodeBuild::Project.SourceAuth": { + "properties": { + "Resource": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::CodeCommit::Repository": { + "properties": { + "RepositoryDescription": { + "type": "string" + }, + "RepositoryName": { + "type": "string" + }, + "Triggers": { + "items": { + "$ref": "#/definitions/AWS::CodeCommit::Repository.RepositoryTrigger" + }, + "type": "array" + } + }, + "required": [ + "RepositoryName" + ], + "type": "object" + }, + "AWS::CodeCommit::Repository.RepositoryTrigger": { + "properties": { + "Branches": { + "items": { + "type": "string" + }, + "type": "array" + }, + "CustomData": { + "type": "string" + }, + "DestinationArn": { + "type": "string" + }, + "Events": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Name": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CodeDeploy::Application": { + "properties": { + "ApplicationName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CodeDeploy::DeploymentConfig": { + "properties": { + "DeploymentConfigName": { + "type": "string" + }, + "MinimumHealthyHosts": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentConfig.MinimumHealthyHosts" + } + }, + "type": "object" + }, + "AWS::CodeDeploy::DeploymentConfig.MinimumHealthyHosts": { + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "number" + } + }, + "required": [ + "Type", + "Value" + ], + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup": { + "properties": { + "AlarmConfiguration": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.AlarmConfiguration" + }, + "ApplicationName": { + "type": "string" + }, + "AutoScalingGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Deployment": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.Deployment" + }, + "DeploymentConfigName": { + "type": "string" + }, + "DeploymentGroupName": { + "type": "string" + }, + "Ec2TagFilters": { + "items": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.EC2TagFilter" + }, + "type": "array" + }, + "OnPremisesInstanceTagFilters": { + "items": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.TagFilter" + }, + "type": "array" + }, + "ServiceRoleArn": { + "type": "string" + }, + "TriggerConfigurations": { + "items": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.TriggerConfig" + }, + "type": "array" + } + }, + "required": [ + "ApplicationName", + "ServiceRoleArn" + ], + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.Alarm": { + "properties": { + "Name": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.AlarmConfiguration": { + "properties": { + "Alarms": { + "items": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.Alarm" + }, + "type": "array" + }, + "Enabled": { + "type": "boolean" + }, + "IgnorePollAlarmFailure": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.Deployment": { + "properties": { + "Description": { + "type": "string" + }, + "IgnoreApplicationStopFailures": { + "type": "boolean" + }, + "Revision": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.RevisionLocation" + } + }, + "required": [ + "Revision" + ], + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.EC2TagFilter": { + "properties": { + "Key": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.GitHubLocation": { + "properties": { + "CommitId": { + "type": "string" + }, + "Repository": { + "type": "string" + } + }, + "required": [ + "CommitId", + "Repository" + ], + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.RevisionLocation": { + "properties": { + "GitHubLocation": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.GitHubLocation" + }, + "RevisionType": { + "type": "string" + }, + "S3Location": { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup.S3Location" + } + }, + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.S3Location": { + "properties": { + "Bucket": { + "type": "string" + }, + "BundleType": { + "type": "string" + }, + "ETag": { + "type": "string" + }, + "Key": { + "type": "string" + }, + "Version": { + "type": "string" + } + }, + "required": [ + "Bucket", + "Key" + ], + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.TagFilter": { + "properties": { + "Key": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CodeDeploy::DeploymentGroup.TriggerConfig": { + "properties": { + "TriggerEvents": { + "items": { + "type": "string" + }, + "type": "array" + }, + "TriggerName": { + "type": "string" + }, + "TriggerTargetArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CodePipeline::CustomActionType": { + "properties": { + "Category": { + "type": "string" + }, + "ConfigurationProperties": { + "items": { + "$ref": "#/definitions/AWS::CodePipeline::CustomActionType.ConfigurationProperties" + }, + "type": "array" + }, + "InputArtifactDetails": { + "$ref": "#/definitions/AWS::CodePipeline::CustomActionType.ArtifactDetails" + }, + "OutputArtifactDetails": { + "$ref": "#/definitions/AWS::CodePipeline::CustomActionType.ArtifactDetails" + }, + "Provider": { + "type": "string" + }, + "Settings": { + "$ref": "#/definitions/AWS::CodePipeline::CustomActionType.Settings" + }, + "Version": { + "type": "string" + } + }, + "required": [ + "Category", + "InputArtifactDetails", + "OutputArtifactDetails", + "Provider" + ], + "type": "object" + }, + "AWS::CodePipeline::CustomActionType.ArtifactDetails": { + "properties": { + "MaximumCount": { + "type": "number" + }, + "MinimumCount": { + "type": "number" + } + }, + "required": [ + "MaximumCount", + "MinimumCount" + ], + "type": "object" + }, + "AWS::CodePipeline::CustomActionType.ConfigurationProperties": { + "properties": { + "Description": { + "type": "string" + }, + "Key": { + "type": "boolean" + }, + "Name": { + "type": "string" + }, + "Queryable": { + "type": "boolean" + }, + "Required": { + "type": "boolean" + }, + "Secret": { + "type": "boolean" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Key", + "Name", + "Required", + "Secret" + ], + "type": "object" + }, + "AWS::CodePipeline::CustomActionType.Settings": { + "properties": { + "EntityUrlTemplate": { + "type": "string" + }, + "ExecutionUrlTemplate": { + "type": "string" + }, + "RevisionUrlTemplate": { + "type": "string" + }, + "ThirdPartyConfigurationUrl": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::CodePipeline::Pipeline": { + "properties": { + "ArtifactStore": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.ArtifactStore" + }, + "DisableInboundStageTransitions": { + "items": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.StageTransition" + }, + "type": "array" + }, + "Name": { + "type": "string" + }, + "RestartExecutionOnUpdate": { + "type": "boolean" + }, + "RoleArn": { + "type": "string" + }, + "Stages": { + "items": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.StageDeclaration" + }, + "type": "array" + } + }, + "required": [ + "ArtifactStore", + "RoleArn", + "Stages" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.ActionDeclaration": { + "properties": { + "ActionTypeId": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.ActionTypeId" + }, + "Configuration": { + "type": "object" + }, + "InputArtifacts": { + "items": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.InputArtifact" + }, + "type": "array" + }, + "Name": { + "type": "string" + }, + "OutputArtifacts": { + "items": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.OutputArtifact" + }, + "type": "array" + }, + "RoleArn": { + "type": "string" + }, + "RunOrder": { + "type": "number" + } + }, + "required": [ + "ActionTypeId", + "Name" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.ActionTypeId": { + "properties": { + "Category": { + "type": "string" + }, + "Owner": { + "type": "string" + }, + "Provider": { + "type": "string" + }, + "Version": { + "type": "string" + } + }, + "required": [ + "Category", + "Owner", + "Provider", + "Version" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.ArtifactStore": { + "properties": { + "EncryptionKey": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.EncryptionKey" + }, + "Location": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Location", + "Type" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.BlockerDeclaration": { + "properties": { + "Name": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Name", + "Type" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.EncryptionKey": { + "properties": { + "Id": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Id", + "Type" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.InputArtifact": { + "properties": { + "Name": { + "type": "string" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.OutputArtifact": { + "properties": { + "Name": { + "type": "string" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.StageDeclaration": { + "properties": { + "Actions": { + "items": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.ActionDeclaration" + }, + "type": "array" + }, + "Blockers": { + "items": { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline.BlockerDeclaration" + }, + "type": "array" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "Actions", + "Name" + ], + "type": "object" + }, + "AWS::CodePipeline::Pipeline.StageTransition": { + "properties": { + "Reason": { + "type": "string" + }, + "StageName": { + "type": "string" + } + }, + "required": [ + "Reason", + "StageName" + ], + "type": "object" + }, + "AWS::Cognito::IdentityPool": { + "properties": { + "AllowUnauthenticatedIdentities": { + "type": "boolean" + }, + "CognitoEvents": { + "type": "object" + }, + "CognitoIdentityProviders": { + "items": { + "$ref": "#/definitions/AWS::Cognito::IdentityPool.CognitoIdentityProvider" + }, + "type": "array" + }, + "CognitoStreams": { + "$ref": "#/definitions/AWS::Cognito::IdentityPool.CognitoStreams" + }, + "DeveloperProviderName": { + "type": "string" + }, + "IdentityPoolName": { + "type": "string" + }, + "OpenIdConnectProviderARNs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "PushSync": { + "$ref": "#/definitions/AWS::Cognito::IdentityPool.PushSync" + }, + "SamlProviderARNs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SupportedLoginProviders": { + "type": "object" + } + }, + "required": [ + "AllowUnauthenticatedIdentities" + ], + "type": "object" + }, + "AWS::Cognito::IdentityPool.CognitoIdentityProvider": { + "properties": { + "ClientId": { + "type": "string" + }, + "ProviderName": { + "type": "string" + }, + "ServerSideTokenCheck": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::Cognito::IdentityPool.CognitoStreams": { + "properties": { + "RoleArn": { + "type": "string" + }, + "StreamName": { + "type": "string" + }, + "StreamingStatus": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::IdentityPool.PushSync": { + "properties": { + "ApplicationArns": { + "items": { + "type": "string" + }, + "type": "array" + }, + "RoleArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::IdentityPoolRoleAttachment": { + "properties": { + "IdentityPoolId": { + "type": "string" + }, + "RoleMappings": { + "type": "object" + }, + "Roles": { + "type": "object" + } + }, + "required": [ + "IdentityPoolId" + ], + "type": "object" + }, + "AWS::Cognito::IdentityPoolRoleAttachment.MappingRule": { + "properties": { + "Claim": { + "type": "string" + }, + "MatchType": { + "type": "string" + }, + "RoleARN": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Claim", + "MatchType", + "RoleARN", + "Value" + ], + "type": "object" + }, + "AWS::Cognito::IdentityPoolRoleAttachment.RoleMapping": { + "properties": { + "AmbiguousRoleResolution": { + "type": "string" + }, + "RulesConfiguration": { + "$ref": "#/definitions/AWS::Cognito::IdentityPoolRoleAttachment.RulesConfigurationType" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::Cognito::IdentityPoolRoleAttachment.RulesConfigurationType": { + "properties": {}, + "type": "object" + }, + "AWS::Cognito::UserPool": { + "properties": { + "AdminCreateUserConfig": { + "$ref": "#/definitions/AWS::Cognito::UserPool.AdminCreateUserConfig" + }, + "AliasAttributes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "AutoVerifiedAttributes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "DeviceConfiguration": { + "$ref": "#/definitions/AWS::Cognito::UserPool.DeviceConfiguration" + }, + "EmailConfiguration": { + "$ref": "#/definitions/AWS::Cognito::UserPool.EmailConfiguration" + }, + "EmailVerificationMessage": { + "type": "string" + }, + "EmailVerificationSubject": { + "type": "string" + }, + "LambdaConfig": { + "$ref": "#/definitions/AWS::Cognito::UserPool.LambdaConfig" + }, + "MfaConfiguration": { + "type": "string" + }, + "Policies": { + "$ref": "#/definitions/AWS::Cognito::UserPool.Policies" + }, + "Schema": { + "items": { + "$ref": "#/definitions/AWS::Cognito::UserPool.SchemaAttribute" + }, + "type": "array" + }, + "SmsAuthenticationMessage": { + "type": "string" + }, + "SmsConfiguration": { + "$ref": "#/definitions/AWS::Cognito::UserPool.SmsConfiguration" + }, + "SmsVerificationMessage": { + "type": "string" + }, + "UserPoolName": { + "type": "string" + }, + "UserPoolTags": { + "type": "object" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.AdminCreateUserConfig": { + "properties": { + "AllowAdminCreateUserOnly": { + "type": "boolean" + }, + "InviteMessageTemplate": { + "$ref": "#/definitions/AWS::Cognito::UserPool.InviteMessageTemplate" + }, + "UnusedAccountValidityDays": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.DeviceConfiguration": { + "properties": { + "ChallengeRequiredOnNewDevice": { + "type": "boolean" + }, + "DeviceOnlyRememberedOnUserPrompt": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.EmailConfiguration": { + "properties": { + "ReplyToEmailAddress": { + "type": "string" + }, + "SourceArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.InviteMessageTemplate": { + "properties": { + "EmailMessage": { + "type": "string" + }, + "EmailSubject": { + "type": "string" + }, + "SMSMessage": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.LambdaConfig": { + "properties": { + "CreateAuthChallenge": { + "type": "string" + }, + "CustomMessage": { + "type": "string" + }, + "DefineAuthChallenge": { + "type": "string" + }, + "PostAuthentication": { + "type": "string" + }, + "PostConfirmation": { + "type": "string" + }, + "PreAuthentication": { + "type": "string" + }, + "PreSignUp": { + "type": "string" + }, + "VerifyAuthChallengeResponse": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.NumberAttributeConstraints": { + "properties": { + "MaxValue": { + "type": "string" + }, + "MinValue": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.PasswordPolicy": { + "properties": { + "MinimumLength": { + "type": "number" + }, + "RequireLowercase": { + "type": "boolean" + }, + "RequireNumbers": { + "type": "boolean" + }, + "RequireSymbols": { + "type": "boolean" + }, + "RequireUppercase": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.Policies": { + "properties": { + "PasswordPolicy": { + "$ref": "#/definitions/AWS::Cognito::UserPool.PasswordPolicy" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.SchemaAttribute": { + "properties": { + "AttributeDataType": { + "type": "string" + }, + "DeveloperOnlyAttribute": { + "type": "boolean" + }, + "Mutable": { + "type": "boolean" + }, + "Name": { + "type": "string" + }, + "NumberAttributeConstraints": { + "$ref": "#/definitions/AWS::Cognito::UserPool.NumberAttributeConstraints" + }, + "Required": { + "type": "boolean" + }, + "StringAttributeConstraints": { + "$ref": "#/definitions/AWS::Cognito::UserPool.StringAttributeConstraints" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.SmsConfiguration": { + "properties": { + "ExternalId": { + "type": "string" + }, + "SnsCallerArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPool.StringAttributeConstraints": { + "properties": { + "MaxLength": { + "type": "string" + }, + "MinLength": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPoolClient": { + "properties": { + "ClientName": { + "type": "string" + }, + "ExplicitAuthFlows": { + "items": { + "type": "string" + }, + "type": "array" + }, + "GenerateSecret": { + "type": "boolean" + }, + "ReadAttributes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "RefreshTokenValidity": { + "type": "number" + }, + "UserPoolId": { + "type": "string" + }, + "WriteAttributes": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "UserPoolId" + ], + "type": "object" + }, + "AWS::Cognito::UserPoolGroup": { + "properties": { + "Description": { + "type": "string" + }, + "GroupName": { + "type": "string" + }, + "Precedence": { + "type": "number" + }, + "RoleArn": { + "type": "string" + }, + "UserPoolId": { + "type": "string" + } + }, + "required": [ + "UserPoolId" + ], + "type": "object" + }, + "AWS::Cognito::UserPoolUser": { + "properties": { + "DesiredDeliveryMediums": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ForceAliasCreation": { + "type": "boolean" + }, + "MessageAction": { + "type": "string" + }, + "UserAttributes": { + "items": { + "$ref": "#/definitions/AWS::Cognito::UserPoolUser.AttributeType" + }, + "type": "array" + }, + "UserPoolId": { + "type": "string" + }, + "Username": { + "type": "string" + }, + "ValidationData": { + "items": { + "$ref": "#/definitions/AWS::Cognito::UserPoolUser.AttributeType" + }, + "type": "array" + } + }, + "required": [ + "UserPoolId" + ], + "type": "object" + }, + "AWS::Cognito::UserPoolUser.AttributeType": { + "properties": { + "Name": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Cognito::UserPoolUserToGroupAttachment": { + "properties": { + "GroupName": { + "type": "string" + }, + "UserPoolId": { + "type": "string" + }, + "Username": { + "type": "string" + } + }, + "required": [ + "GroupName", + "UserPoolId", + "Username" + ], + "type": "object" + }, + "AWS::Config::ConfigRule": { + "properties": { + "ConfigRuleName": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "InputParameters": { + "type": "object" + }, + "MaximumExecutionFrequency": { + "type": "string" + }, + "Scope": { + "$ref": "#/definitions/AWS::Config::ConfigRule.Scope" + }, + "Source": { + "$ref": "#/definitions/AWS::Config::ConfigRule.Source" + } + }, + "required": [ + "Source" + ], + "type": "object" + }, + "AWS::Config::ConfigRule.Scope": { + "properties": { + "ComplianceResourceId": { + "type": "string" + }, + "ComplianceResourceTypes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "TagKey": { + "type": "string" + }, + "TagValue": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Config::ConfigRule.Source": { + "properties": { + "Owner": { + "type": "string" + }, + "SourceDetails": { + "items": { + "$ref": "#/definitions/AWS::Config::ConfigRule.SourceDetail" + }, + "type": "array" + }, + "SourceIdentifier": { + "type": "string" + } + }, + "required": [ + "Owner", + "SourceIdentifier" + ], + "type": "object" + }, + "AWS::Config::ConfigRule.SourceDetail": { + "properties": { + "EventSource": { + "type": "string" + }, + "MaximumExecutionFrequency": { + "type": "string" + }, + "MessageType": { + "type": "string" + } + }, + "required": [ + "EventSource", + "MessageType" + ], + "type": "object" + }, + "AWS::Config::ConfigurationRecorder": { + "properties": { + "Name": { + "type": "string" + }, + "RecordingGroup": { + "$ref": "#/definitions/AWS::Config::ConfigurationRecorder.RecordingGroup" + }, + "RoleARN": { + "type": "string" + } + }, + "required": [ + "RoleARN" + ], + "type": "object" + }, + "AWS::Config::ConfigurationRecorder.RecordingGroup": { + "properties": { + "AllSupported": { + "type": "boolean" + }, + "IncludeGlobalResourceTypes": { + "type": "boolean" + }, + "ResourceTypes": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::Config::DeliveryChannel": { + "properties": { + "ConfigSnapshotDeliveryProperties": { + "$ref": "#/definitions/AWS::Config::DeliveryChannel.ConfigSnapshotDeliveryProperties" + }, + "Name": { + "type": "string" + }, + "S3BucketName": { + "type": "string" + }, + "S3KeyPrefix": { + "type": "string" + }, + "SnsTopicARN": { + "type": "string" + } + }, + "required": [ + "S3BucketName" + ], + "type": "object" + }, + "AWS::Config::DeliveryChannel.ConfigSnapshotDeliveryProperties": { + "properties": { + "DeliveryFrequency": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::DMS::Certificate": { + "properties": { + "CertificateIdentifier": { + "type": "string" + }, + "CertificatePem": { + "type": "string" + }, + "CertificateWallet": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::DMS::Endpoint": { + "properties": { + "CertificateArn": { + "type": "string" + }, + "DatabaseName": { + "type": "string" + }, + "DynamoDbSettings": { + "$ref": "#/definitions/AWS::DMS::Endpoint.DynamoDbSettings" + }, + "EndpointIdentifier": { + "type": "string" + }, + "EndpointType": { + "type": "string" + }, + "EngineName": { + "type": "string" + }, + "ExtraConnectionAttributes": { + "type": "string" + }, + "KmsKeyId": { + "type": "string" + }, + "MongoDbSettings": { + "$ref": "#/definitions/AWS::DMS::Endpoint.MongoDbSettings" + }, + "Password": { + "type": "string" + }, + "Port": { + "type": "number" + }, + "S3Settings": { + "$ref": "#/definitions/AWS::DMS::Endpoint.S3Settings" + }, + "ServerName": { + "type": "string" + }, + "SslMode": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "Username": { + "type": "string" + } + }, + "required": [ + "EndpointType", + "EngineName" + ], + "type": "object" + }, + "AWS::DMS::Endpoint.DynamoDbSettings": { + "properties": { + "ServiceAccessRoleArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::DMS::Endpoint.MongoDbSettings": { + "properties": { + "AuthMechanism": { + "type": "string" + }, + "AuthSource": { + "type": "string" + }, + "AuthType": { + "type": "string" + }, + "DatabaseName": { + "type": "string" + }, + "DocsToInvestigate": { + "type": "string" + }, + "ExtractDocId": { + "type": "string" + }, + "NestingLevel": { + "type": "string" + }, + "Password": { + "type": "string" + }, + "Port": { + "type": "number" + }, + "ServerName": { + "type": "string" + }, + "Username": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::DMS::Endpoint.S3Settings": { + "properties": { + "BucketFolder": { + "type": "string" + }, + "BucketName": { + "type": "string" + }, + "CompressionType": { + "type": "string" + }, + "CsvDelimiter": { + "type": "string" + }, + "CsvRowDelimiter": { + "type": "string" + }, + "ExternalTableDefinition": { + "type": "string" + }, + "ServiceAccessRoleArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::DMS::EventSubscription": { + "properties": { + "Enabled": { + "type": "boolean" + }, + "EventCategories": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SnsTopicArn": { + "type": "string" + }, + "SourceIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SourceType": { + "type": "string" + }, + "SubscriptionName": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "SnsTopicArn" + ], + "type": "object" + }, + "AWS::DMS::ReplicationInstance": { + "properties": { + "AllocatedStorage": { + "type": "number" + }, + "AllowMajorVersionUpgrade": { + "type": "boolean" + }, + "AutoMinorVersionUpgrade": { + "type": "boolean" + }, + "AvailabilityZone": { + "type": "string" + }, + "EngineVersion": { + "type": "string" + }, + "KmsKeyId": { + "type": "string" + }, + "MultiAZ": { + "type": "boolean" + }, + "PreferredMaintenanceWindow": { + "type": "string" + }, + "PubliclyAccessible": { + "type": "boolean" + }, + "ReplicationInstanceClass": { + "type": "string" + }, + "ReplicationInstanceIdentifier": { + "type": "string" + }, + "ReplicationSubnetGroupIdentifier": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcSecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "ReplicationInstanceClass" + ], + "type": "object" + }, + "AWS::DMS::ReplicationSubnetGroup": { + "properties": { + "ReplicationSubnetGroupDescription": { + "type": "string" + }, + "ReplicationSubnetGroupIdentifier": { + "type": "string" + }, + "SubnetIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "ReplicationSubnetGroupDescription", + "SubnetIds" + ], + "type": "object" + }, + "AWS::DMS::ReplicationTask": { + "properties": { + "CdcStartTime": { + "type": "number" + }, + "MigrationType": { + "type": "string" + }, + "ReplicationInstanceArn": { + "type": "string" + }, + "ReplicationTaskIdentifier": { + "type": "string" + }, + "ReplicationTaskSettings": { + "type": "string" + }, + "SourceEndpointArn": { + "type": "string" + }, + "TableMappings": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "TargetEndpointArn": { + "type": "string" + } + }, + "required": [ + "MigrationType", + "ReplicationInstanceArn", + "SourceEndpointArn", + "TableMappings", + "TargetEndpointArn" + ], + "type": "object" + }, + "AWS::DataPipeline::Pipeline": { + "properties": { + "Activate": { + "type": "boolean" + }, + "Description": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "ParameterObjects": { + "items": { + "$ref": "#/definitions/AWS::DataPipeline::Pipeline.ParameterObject" + }, + "type": "array" + }, + "ParameterValues": { + "items": { + "$ref": "#/definitions/AWS::DataPipeline::Pipeline.ParameterValue" + }, + "type": "array" + }, + "PipelineObjects": { + "items": { + "$ref": "#/definitions/AWS::DataPipeline::Pipeline.PipelineObject" + }, + "type": "array" + }, + "PipelineTags": { + "items": { + "$ref": "#/definitions/AWS::DataPipeline::Pipeline.PipelineTag" + }, + "type": "array" + } + }, + "required": [ + "Name", + "ParameterObjects" + ], + "type": "object" + }, + "AWS::DataPipeline::Pipeline.Field": { + "properties": { + "Key": { + "type": "string" + }, + "RefValue": { + "type": "string" + }, + "StringValue": { + "type": "string" + } + }, + "required": [ + "Key" + ], + "type": "object" + }, + "AWS::DataPipeline::Pipeline.ParameterAttribute": { + "properties": { + "Key": { + "type": "string" + }, + "StringValue": { + "type": "string" + } + }, + "required": [ + "Key", + "StringValue" + ], + "type": "object" + }, + "AWS::DataPipeline::Pipeline.ParameterObject": { + "properties": { + "Attributes": { + "items": { + "$ref": "#/definitions/AWS::DataPipeline::Pipeline.ParameterAttribute" + }, + "type": "array" + }, + "Id": { + "type": "string" + } + }, + "required": [ + "Attributes", + "Id" + ], + "type": "object" + }, + "AWS::DataPipeline::Pipeline.ParameterValue": { + "properties": { + "Id": { + "type": "string" + }, + "StringValue": { + "type": "string" + } + }, + "required": [ + "Id", + "StringValue" + ], + "type": "object" + }, + "AWS::DataPipeline::Pipeline.PipelineObject": { + "properties": { + "Fields": { + "items": { + "$ref": "#/definitions/AWS::DataPipeline::Pipeline.Field" + }, + "type": "array" + }, + "Id": { + "type": "string" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "Fields", + "Id", + "Name" + ], + "type": "object" + }, + "AWS::DataPipeline::Pipeline.PipelineTag": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + }, + "AWS::DirectoryService::MicrosoftAD": { + "properties": { + "CreateAlias": { + "type": "boolean" + }, + "EnableSso": { + "type": "boolean" + }, + "Name": { + "type": "string" + }, + "Password": { + "type": "string" + }, + "ShortName": { + "type": "string" + }, + "VpcSettings": { + "$ref": "#/definitions/AWS::DirectoryService::MicrosoftAD.VpcSettings" + } + }, + "required": [ + "Name", + "Password", + "VpcSettings" + ], + "type": "object" + }, + "AWS::DirectoryService::MicrosoftAD.VpcSettings": { + "properties": { + "SubnetIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "SubnetIds", + "VpcId" + ], + "type": "object" + }, + "AWS::DirectoryService::SimpleAD": { + "properties": { + "CreateAlias": { + "type": "boolean" + }, + "Description": { + "type": "string" + }, + "EnableSso": { + "type": "boolean" + }, + "Name": { + "type": "string" + }, + "Password": { + "type": "string" + }, + "ShortName": { + "type": "string" + }, + "Size": { + "type": "string" + }, + "VpcSettings": { + "$ref": "#/definitions/AWS::DirectoryService::SimpleAD.VpcSettings" + } + }, + "required": [ + "Name", + "Password", + "Size", + "VpcSettings" + ], + "type": "object" + }, + "AWS::DirectoryService::SimpleAD.VpcSettings": { + "properties": { + "SubnetIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "SubnetIds", + "VpcId" + ], + "type": "object" + }, + "AWS::DynamoDB::Table": { + "properties": { + "AttributeDefinitions": { + "items": { + "$ref": "#/definitions/AWS::DynamoDB::Table.AttributeDefinition" + }, + "type": "array" + }, + "GlobalSecondaryIndexes": { + "items": { + "$ref": "#/definitions/AWS::DynamoDB::Table.GlobalSecondaryIndex" + }, + "type": "array" + }, + "KeySchema": { + "items": { + "$ref": "#/definitions/AWS::DynamoDB::Table.KeySchema" + }, + "type": "array" + }, + "LocalSecondaryIndexes": { + "items": { + "$ref": "#/definitions/AWS::DynamoDB::Table.LocalSecondaryIndex" + }, + "type": "array" + }, + "ProvisionedThroughput": { + "$ref": "#/definitions/AWS::DynamoDB::Table.ProvisionedThroughput" + }, + "StreamSpecification": { + "$ref": "#/definitions/AWS::DynamoDB::Table.StreamSpecification" + }, + "TableName": { + "type": "string" + } + }, + "required": [ + "AttributeDefinitions", + "KeySchema", + "ProvisionedThroughput" + ], + "type": "object" + }, + "AWS::DynamoDB::Table.AttributeDefinition": { + "properties": { + "AttributeName": { + "type": "string" + }, + "AttributeType": { + "type": "string" + } + }, + "required": [ + "AttributeName", + "AttributeType" + ], + "type": "object" + }, + "AWS::DynamoDB::Table.GlobalSecondaryIndex": { + "properties": { + "IndexName": { + "type": "string" + }, + "KeySchema": { + "items": { + "$ref": "#/definitions/AWS::DynamoDB::Table.KeySchema" + }, + "type": "array" + }, + "Projection": { + "$ref": "#/definitions/AWS::DynamoDB::Table.Projection" + }, + "ProvisionedThroughput": { + "$ref": "#/definitions/AWS::DynamoDB::Table.ProvisionedThroughput" + } + }, + "required": [ + "IndexName", + "KeySchema", + "Projection", + "ProvisionedThroughput" + ], + "type": "object" + }, + "AWS::DynamoDB::Table.KeySchema": { + "properties": { + "AttributeName": { + "type": "string" + }, + "KeyType": { + "type": "string" + } + }, + "required": [ + "AttributeName", + "KeyType" + ], + "type": "object" + }, + "AWS::DynamoDB::Table.LocalSecondaryIndex": { + "properties": { + "IndexName": { + "type": "string" + }, + "KeySchema": { + "items": { + "$ref": "#/definitions/AWS::DynamoDB::Table.KeySchema" + }, + "type": "array" + }, + "Projection": { + "$ref": "#/definitions/AWS::DynamoDB::Table.Projection" + } + }, + "required": [ + "IndexName", + "KeySchema", + "Projection" + ], + "type": "object" + }, + "AWS::DynamoDB::Table.Projection": { + "properties": { + "NonKeyAttributes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ProjectionType": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::DynamoDB::Table.ProvisionedThroughput": { + "properties": { + "ReadCapacityUnits": { + "type": "number" + }, + "WriteCapacityUnits": { + "type": "number" + } + }, + "required": [ + "ReadCapacityUnits", + "WriteCapacityUnits" + ], + "type": "object" + }, + "AWS::DynamoDB::Table.StreamSpecification": { + "properties": { + "StreamViewType": { + "type": "string" + } + }, + "required": [ + "StreamViewType" + ], + "type": "object" + }, + "AWS::EC2::CustomerGateway": { + "properties": { + "BgpAsn": { + "type": "number" + }, + "IpAddress": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "BgpAsn", + "IpAddress", + "Type" + ], + "type": "object" + }, + "AWS::EC2::DHCPOptions": { + "properties": { + "DomainName": { + "type": "string" + }, + "DomainNameServers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "NetbiosNameServers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "NetbiosNodeType": { + "type": "number" + }, + "NtpServers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::EC2::EIP": { + "properties": { + "Domain": { + "type": "string" + }, + "InstanceId": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EC2::EIPAssociation": { + "properties": { + "AllocationId": { + "type": "string" + }, + "EIP": { + "type": "string" + }, + "InstanceId": { + "type": "string" + }, + "NetworkInterfaceId": { + "type": "string" + }, + "PrivateIpAddress": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EC2::EgressOnlyInternetGateway": { + "properties": { + "VpcId": { + "type": "string" + } + }, + "required": [ + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::FlowLog": { + "properties": { + "DeliverLogsPermissionArn": { + "type": "string" + }, + "LogGroupName": { + "type": "string" + }, + "ResourceId": { + "type": "string" + }, + "ResourceType": { + "type": "string" + }, + "TrafficType": { + "type": "string" + } + }, + "required": [ + "DeliverLogsPermissionArn", + "LogGroupName", + "ResourceId", + "ResourceType", + "TrafficType" + ], + "type": "object" + }, + "AWS::EC2::Host": { + "properties": { + "AutoPlacement": { + "type": "string" + }, + "AvailabilityZone": { + "type": "string" + }, + "InstanceType": { + "type": "string" + } + }, + "required": [ + "AvailabilityZone", + "InstanceType" + ], + "type": "object" + }, + "AWS::EC2::Instance": { + "properties": { + "AdditionalInfo": { + "type": "string" + }, + "Affinity": { + "type": "string" + }, + "AvailabilityZone": { + "type": "string" + }, + "BlockDeviceMappings": { + "items": { + "$ref": "#/definitions/AWS::EC2::Instance.BlockDeviceMapping" + }, + "type": "array" + }, + "DisableApiTermination": { + "type": "boolean" + }, + "EbsOptimized": { + "type": "boolean" + }, + "HostId": { + "type": "string" + }, + "IamInstanceProfile": { + "type": "string" + }, + "ImageId": { + "type": "string" + }, + "InstanceInitiatedShutdownBehavior": { + "type": "string" + }, + "InstanceType": { + "type": "string" + }, + "Ipv6AddressCount": { + "type": "number" + }, + "Ipv6Addresses": { + "items": { + "$ref": "#/definitions/AWS::EC2::Instance.InstanceIpv6Address" + }, + "type": "array" + }, + "KernelId": { + "type": "string" + }, + "KeyName": { + "type": "string" + }, + "Monitoring": { + "type": "boolean" + }, + "NetworkInterfaces": { + "items": { + "$ref": "#/definitions/AWS::EC2::Instance.NetworkInterface" + }, + "type": "array" + }, + "PlacementGroupName": { + "type": "string" + }, + "PrivateIpAddress": { + "type": "string" + }, + "RamdiskId": { + "type": "string" + }, + "SecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SourceDestCheck": { + "type": "boolean" + }, + "SsmAssociations": { + "items": { + "$ref": "#/definitions/AWS::EC2::Instance.SsmAssociation" + }, + "type": "array" + }, + "SubnetId": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "Tenancy": { + "type": "string" + }, + "UserData": { + "type": "string" + }, + "Volumes": { + "items": { + "$ref": "#/definitions/AWS::EC2::Instance.Volume" + }, + "type": "array" + } + }, + "required": [ + "ImageId" + ], + "type": "object" + }, + "AWS::EC2::Instance.AssociationParameter": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + }, + "AWS::EC2::Instance.BlockDeviceMapping": { + "properties": { + "DeviceName": { + "type": "string" + }, + "Ebs": { + "$ref": "#/definitions/AWS::EC2::Instance.Ebs" + }, + "NoDevice": { + "$ref": "#/definitions/AWS::EC2::Instance.NoDevice" + }, + "VirtualName": { + "type": "string" + } + }, + "required": [ + "DeviceName" + ], + "type": "object" + }, + "AWS::EC2::Instance.Ebs": { + "properties": { + "DeleteOnTermination": { + "type": "boolean" + }, + "Encrypted": { + "type": "boolean" + }, + "Iops": { + "type": "number" + }, + "SnapshotId": { + "type": "string" + }, + "VolumeSize": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EC2::Instance.InstanceIpv6Address": { + "properties": { + "Ipv6Address": { + "type": "string" + } + }, + "required": [ + "Ipv6Address" + ], + "type": "object" + }, + "AWS::EC2::Instance.NetworkInterface": { + "properties": { + "AssociatePublicIpAddress": { + "type": "boolean" + }, + "DeleteOnTermination": { + "type": "boolean" + }, + "Description": { + "type": "string" + }, + "DeviceIndex": { + "type": "string" + }, + "GroupSet": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Ipv6AddressCount": { + "type": "number" + }, + "Ipv6Addresses": { + "items": { + "$ref": "#/definitions/AWS::EC2::Instance.InstanceIpv6Address" + }, + "type": "array" + }, + "NetworkInterfaceId": { + "type": "string" + }, + "PrivateIpAddress": { + "type": "string" + }, + "PrivateIpAddresses": { + "items": { + "$ref": "#/definitions/AWS::EC2::Instance.PrivateIpAddressSpecification" + }, + "type": "array" + }, + "SecondaryPrivateIpAddressCount": { + "type": "number" + }, + "SubnetId": { + "type": "string" + } + }, + "required": [ + "DeviceIndex" + ], + "type": "object" + }, + "AWS::EC2::Instance.NoDevice": { + "properties": {}, + "type": "object" + }, + "AWS::EC2::Instance.PrivateIpAddressSpecification": { + "properties": { + "Primary": { + "type": "boolean" + }, + "PrivateIpAddress": { + "type": "string" + } + }, + "required": [ + "Primary", + "PrivateIpAddress" + ], + "type": "object" + }, + "AWS::EC2::Instance.SsmAssociation": { + "properties": { + "AssociationParameters": { + "items": { + "$ref": "#/definitions/AWS::EC2::Instance.AssociationParameter" + }, + "type": "array" + }, + "DocumentName": { + "type": "string" + } + }, + "required": [ + "DocumentName" + ], + "type": "object" + }, + "AWS::EC2::Instance.Volume": { + "properties": { + "Device": { + "type": "string" + }, + "VolumeId": { + "type": "string" + } + }, + "required": [ + "Device", + "VolumeId" + ], + "type": "object" + }, + "AWS::EC2::InternetGateway": { + "properties": { + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::EC2::NatGateway": { + "properties": { + "AllocationId": { + "type": "string" + }, + "SubnetId": { + "type": "string" + } + }, + "required": [ + "AllocationId", + "SubnetId" + ], + "type": "object" + }, + "AWS::EC2::NetworkAcl": { + "properties": { + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::NetworkAclEntry": { + "properties": { + "CidrBlock": { + "type": "string" + }, + "Egress": { + "type": "boolean" + }, + "Icmp": { + "$ref": "#/definitions/AWS::EC2::NetworkAclEntry.Icmp" + }, + "Ipv6CidrBlock": { + "type": "string" + }, + "NetworkAclId": { + "type": "string" + }, + "PortRange": { + "$ref": "#/definitions/AWS::EC2::NetworkAclEntry.PortRange" + }, + "Protocol": { + "type": "number" + }, + "RuleAction": { + "type": "string" + }, + "RuleNumber": { + "type": "number" + } + }, + "required": [ + "CidrBlock", + "NetworkAclId", + "Protocol", + "RuleAction", + "RuleNumber" + ], + "type": "object" + }, + "AWS::EC2::NetworkAclEntry.Icmp": { + "properties": { + "Code": { + "type": "number" + }, + "Type": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::EC2::NetworkAclEntry.PortRange": { + "properties": { + "From": { + "type": "number" + }, + "To": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::EC2::NetworkInterface": { + "properties": { + "Description": { + "type": "string" + }, + "GroupSet": { + "items": { + "type": "string" + }, + "type": "array" + }, + "InterfaceType": { + "type": "string" + }, + "Ipv6AddressCount": { + "type": "number" + }, + "Ipv6Addresses": { + "$ref": "#/definitions/AWS::EC2::NetworkInterface.InstanceIpv6Address" + }, + "PrivateIpAddress": { + "type": "string" + }, + "PrivateIpAddresses": { + "items": { + "$ref": "#/definitions/AWS::EC2::NetworkInterface.PrivateIpAddressSpecification" + }, + "type": "array" + }, + "SecondaryPrivateIpAddressCount": { + "type": "number" + }, + "SourceDestCheck": { + "type": "boolean" + }, + "SubnetId": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "SubnetId" + ], + "type": "object" + }, + "AWS::EC2::NetworkInterface.InstanceIpv6Address": { + "properties": { + "Ipv6Address": { + "type": "string" + } + }, + "required": [ + "Ipv6Address" + ], + "type": "object" + }, + "AWS::EC2::NetworkInterface.PrivateIpAddressSpecification": { + "properties": { + "Primary": { + "type": "boolean" + }, + "PrivateIpAddress": { + "type": "string" + } + }, + "required": [ + "Primary", + "PrivateIpAddress" + ], + "type": "object" + }, + "AWS::EC2::NetworkInterfaceAttachment": { + "properties": { + "DeleteOnTermination": { + "type": "boolean" + }, + "DeviceIndex": { + "type": "string" + }, + "InstanceId": { + "type": "string" + }, + "NetworkInterfaceId": { + "type": "string" + } + }, + "required": [ + "DeviceIndex", + "InstanceId", + "NetworkInterfaceId" + ], + "type": "object" + }, + "AWS::EC2::NetworkInterfacePermission": { + "properties": { + "AwsAccountId": { + "type": "string" + }, + "NetworkInterfaceId": { + "type": "string" + }, + "Permission": { + "type": "string" + } + }, + "required": [ + "AwsAccountId", + "NetworkInterfaceId", + "Permission" + ], + "type": "object" + }, + "AWS::EC2::PlacementGroup": { + "properties": { + "Strategy": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EC2::Route": { + "properties": { + "DestinationCidrBlock": { + "type": "string" + }, + "DestinationIpv6CidrBlock": { + "type": "string" + }, + "GatewayId": { + "type": "string" + }, + "InstanceId": { + "type": "string" + }, + "NatGatewayId": { + "type": "string" + }, + "NetworkInterfaceId": { + "type": "string" + }, + "RouteTableId": { + "type": "string" + }, + "VpcPeeringConnectionId": { + "type": "string" + } + }, + "required": [ + "RouteTableId" + ], + "type": "object" + }, + "AWS::EC2::RouteTable": { + "properties": { + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::SecurityGroup": { + "properties": { + "GroupDescription": { + "type": "string" + }, + "GroupName": { + "type": "string" + }, + "SecurityGroupEgress": { + "items": { + "$ref": "#/definitions/AWS::EC2::SecurityGroup.Egress" + }, + "type": "array" + }, + "SecurityGroupIngress": { + "items": { + "$ref": "#/definitions/AWS::EC2::SecurityGroup.Ingress" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "GroupDescription" + ], + "type": "object" + }, + "AWS::EC2::SecurityGroup.Egress": { + "properties": { + "CidrIp": { + "type": "string" + }, + "CidrIpv6": { + "type": "string" + }, + "DestinationPrefixListId": { + "type": "string" + }, + "DestinationSecurityGroupId": { + "type": "string" + }, + "FromPort": { + "type": "number" + }, + "IpProtocol": { + "type": "string" + }, + "ToPort": { + "type": "number" + } + }, + "required": [ + "IpProtocol" + ], + "type": "object" + }, + "AWS::EC2::SecurityGroup.Ingress": { + "properties": { + "CidrIp": { + "type": "string" + }, + "CidrIpv6": { + "type": "string" + }, + "FromPort": { + "type": "number" + }, + "IpProtocol": { + "type": "string" + }, + "SourceSecurityGroupId": { + "type": "string" + }, + "SourceSecurityGroupName": { + "type": "string" + }, + "SourceSecurityGroupOwnerId": { + "type": "string" + }, + "ToPort": { + "type": "number" + } + }, + "required": [ + "IpProtocol" + ], + "type": "object" + }, + "AWS::EC2::SecurityGroupEgress": { + "properties": { + "CidrIp": { + "type": "string" + }, + "CidrIpv6": { + "type": "string" + }, + "DestinationPrefixListId": { + "type": "string" + }, + "DestinationSecurityGroupId": { + "type": "string" + }, + "FromPort": { + "type": "number" + }, + "GroupId": { + "type": "string" + }, + "IpProtocol": { + "type": "string" + }, + "ToPort": { + "type": "number" + } + }, + "required": [ + "GroupId", + "IpProtocol" + ], + "type": "object" + }, + "AWS::EC2::SecurityGroupIngress": { + "properties": { + "CidrIp": { + "type": "string" + }, + "CidrIpv6": { + "type": "string" + }, + "FromPort": { + "type": "number" + }, + "GroupId": { + "type": "string" + }, + "GroupName": { + "type": "string" + }, + "IpProtocol": { + "type": "string" + }, + "SourceSecurityGroupId": { + "type": "string" + }, + "SourceSecurityGroupName": { + "type": "string" + }, + "SourceSecurityGroupOwnerId": { + "type": "string" + }, + "ToPort": { + "type": "number" + } + }, + "required": [ + "IpProtocol" + ], + "type": "object" + }, + "AWS::EC2::SpotFleet": { + "properties": { + "SpotFleetRequestConfigData": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.SpotFleetRequestConfigData" + } + }, + "required": [ + "SpotFleetRequestConfigData" + ], + "type": "object" + }, + "AWS::EC2::SpotFleet.BlockDeviceMapping": { + "properties": { + "DeviceName": { + "type": "string" + }, + "Ebs": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.EbsBlockDevice" + }, + "NoDevice": { + "type": "string" + }, + "VirtualName": { + "type": "string" + } + }, + "required": [ + "DeviceName" + ], + "type": "object" + }, + "AWS::EC2::SpotFleet.EbsBlockDevice": { + "properties": { + "DeleteOnTermination": { + "type": "boolean" + }, + "Encrypted": { + "type": "boolean" + }, + "Iops": { + "type": "number" + }, + "SnapshotId": { + "type": "string" + }, + "VolumeSize": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EC2::SpotFleet.GroupIdentifier": { + "properties": { + "GroupId": { + "type": "string" + } + }, + "required": [ + "GroupId" + ], + "type": "object" + }, + "AWS::EC2::SpotFleet.IamInstanceProfileSpecification": { + "properties": { + "Arn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EC2::SpotFleet.InstanceIpv6Address": { + "properties": { + "Ipv6Address": { + "type": "string" + } + }, + "required": [ + "Ipv6Address" + ], + "type": "object" + }, + "AWS::EC2::SpotFleet.InstanceNetworkInterfaceSpecification": { + "properties": { + "AssociatePublicIpAddress": { + "type": "boolean" + }, + "DeleteOnTermination": { + "type": "boolean" + }, + "Description": { + "type": "string" + }, + "DeviceIndex": { + "type": "number" + }, + "Groups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Ipv6AddressCount": { + "type": "number" + }, + "Ipv6Addresses": { + "items": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.InstanceIpv6Address" + }, + "type": "array" + }, + "NetworkInterfaceId": { + "type": "string" + }, + "PrivateIpAddresses": { + "items": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.PrivateIpAddressSpecification" + }, + "type": "array" + }, + "SecondaryPrivateIpAddressCount": { + "type": "number" + }, + "SubnetId": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EC2::SpotFleet.PrivateIpAddressSpecification": { + "properties": { + "Primary": { + "type": "boolean" + }, + "PrivateIpAddress": { + "type": "string" + } + }, + "required": [ + "PrivateIpAddress" + ], + "type": "object" + }, + "AWS::EC2::SpotFleet.SpotFleetLaunchSpecification": { + "properties": { + "BlockDeviceMappings": { + "items": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.BlockDeviceMapping" + }, + "type": "array" + }, + "EbsOptimized": { + "type": "boolean" + }, + "IamInstanceProfile": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.IamInstanceProfileSpecification" + }, + "ImageId": { + "type": "string" + }, + "InstanceType": { + "type": "string" + }, + "KernelId": { + "type": "string" + }, + "KeyName": { + "type": "string" + }, + "Monitoring": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.SpotFleetMonitoring" + }, + "NetworkInterfaces": { + "items": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.InstanceNetworkInterfaceSpecification" + }, + "type": "array" + }, + "Placement": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.SpotPlacement" + }, + "RamdiskId": { + "type": "string" + }, + "SecurityGroups": { + "items": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.GroupIdentifier" + }, + "type": "array" + }, + "SpotPrice": { + "type": "string" + }, + "SubnetId": { + "type": "string" + }, + "UserData": { + "type": "string" + }, + "WeightedCapacity": { + "type": "number" + } + }, + "required": [ + "ImageId", + "InstanceType" + ], + "type": "object" + }, + "AWS::EC2::SpotFleet.SpotFleetMonitoring": { + "properties": { + "Enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::EC2::SpotFleet.SpotFleetRequestConfigData": { + "properties": { + "AllocationStrategy": { + "type": "string" + }, + "ExcessCapacityTerminationPolicy": { + "type": "string" + }, + "IamFleetRole": { + "type": "string" + }, + "LaunchSpecifications": { + "items": { + "$ref": "#/definitions/AWS::EC2::SpotFleet.SpotFleetLaunchSpecification" + }, + "type": "array" + }, + "SpotPrice": { + "type": "string" + }, + "TargetCapacity": { + "type": "number" + }, + "TerminateInstancesWithExpiration": { + "type": "boolean" + }, + "ValidFrom": { + "type": "string" + }, + "ValidUntil": { + "type": "string" + } + }, + "required": [ + "IamFleetRole", + "LaunchSpecifications", + "SpotPrice", + "TargetCapacity" + ], + "type": "object" + }, + "AWS::EC2::SpotFleet.SpotPlacement": { + "properties": { + "AvailabilityZone": { + "type": "string" + }, + "GroupName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EC2::Subnet": { + "properties": { + "AvailabilityZone": { + "type": "string" + }, + "CidrBlock": { + "type": "string" + }, + "MapPublicIpOnLaunch": { + "type": "boolean" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "CidrBlock", + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::SubnetCidrBlock": { + "properties": { + "Ipv6CidrBlock": { + "type": "string" + }, + "SubnetId": { + "type": "string" + } + }, + "required": [ + "Ipv6CidrBlock", + "SubnetId" + ], + "type": "object" + }, + "AWS::EC2::SubnetNetworkAclAssociation": { + "properties": { + "NetworkAclId": { + "type": "string" + }, + "SubnetId": { + "type": "string" + } + }, + "required": [ + "NetworkAclId", + "SubnetId" + ], + "type": "object" + }, + "AWS::EC2::SubnetRouteTableAssociation": { + "properties": { + "RouteTableId": { + "type": "string" + }, + "SubnetId": { + "type": "string" + } + }, + "required": [ + "RouteTableId", + "SubnetId" + ], + "type": "object" + }, + "AWS::EC2::TrunkInterfaceAssociation": { + "properties": { + "BranchInterfaceId": { + "type": "string" + }, + "GREKey": { + "type": "number" + }, + "TrunkInterfaceId": { + "type": "string" + }, + "VLANId": { + "type": "number" + } + }, + "required": [ + "BranchInterfaceId", + "TrunkInterfaceId" + ], + "type": "object" + }, + "AWS::EC2::VPC": { + "properties": { + "CidrBlock": { + "type": "string" + }, + "EnableDnsHostnames": { + "type": "boolean" + }, + "EnableDnsSupport": { + "type": "boolean" + }, + "InstanceTenancy": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "CidrBlock" + ], + "type": "object" + }, + "AWS::EC2::VPCCidrBlock": { + "properties": { + "AmazonProvidedIpv6CidrBlock": { + "type": "boolean" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::VPCDHCPOptionsAssociation": { + "properties": { + "DhcpOptionsId": { + "type": "string" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "DhcpOptionsId", + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::VPCEndpoint": { + "properties": { + "PolicyDocument": { + "type": "object" + }, + "RouteTableIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ServiceName": { + "type": "string" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "ServiceName", + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::VPCGatewayAttachment": { + "properties": { + "InternetGatewayId": { + "type": "string" + }, + "VpcId": { + "type": "string" + }, + "VpnGatewayId": { + "type": "string" + } + }, + "required": [ + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::VPCPeeringConnection": { + "properties": { + "PeerOwnerId": { + "type": "string" + }, + "PeerRoleArn": { + "type": "string" + }, + "PeerVpcId": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "PeerVpcId", + "VpcId" + ], + "type": "object" + }, + "AWS::EC2::VPNConnection": { + "properties": { + "CustomerGatewayId": { + "type": "string" + }, + "StaticRoutesOnly": { + "type": "boolean" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "Type": { + "type": "string" + }, + "VpnGatewayId": { + "type": "string" + } + }, + "required": [ + "CustomerGatewayId", + "Type", + "VpnGatewayId" + ], + "type": "object" + }, + "AWS::EC2::VPNConnectionRoute": { + "properties": { + "DestinationCidrBlock": { + "type": "string" + }, + "VpnConnectionId": { + "type": "string" + } + }, + "required": [ + "DestinationCidrBlock", + "VpnConnectionId" + ], + "type": "object" + }, + "AWS::EC2::VPNGateway": { + "properties": { + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::EC2::VPNGatewayRoutePropagation": { + "properties": { + "RouteTableIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "VpnGatewayId": { + "type": "string" + } + }, + "required": [ + "RouteTableIds", + "VpnGatewayId" + ], + "type": "object" + }, + "AWS::EC2::Volume": { + "properties": { + "AutoEnableIO": { + "type": "boolean" + }, + "AvailabilityZone": { + "type": "string" + }, + "Encrypted": { + "type": "boolean" + }, + "Iops": { + "type": "number" + }, + "KmsKeyId": { + "type": "string" + }, + "Size": { + "type": "number" + }, + "SnapshotId": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VolumeType": { + "type": "string" + } + }, + "required": [ + "AvailabilityZone" + ], + "type": "object" + }, + "AWS::EC2::VolumeAttachment": { + "properties": { + "Device": { + "type": "string" + }, + "InstanceId": { + "type": "string" + }, + "VolumeId": { + "type": "string" + } + }, + "required": [ + "Device", + "InstanceId", + "VolumeId" + ], + "type": "object" + }, + "AWS::ECR::Repository": { + "properties": { + "RepositoryName": { + "type": "string" + }, + "RepositoryPolicyText": { + "type": "object" + } + }, + "type": "object" + }, + "AWS::ECS::Cluster": { + "properties": { + "ClusterName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ECS::Service": { + "properties": { + "Cluster": { + "type": "string" + }, + "DeploymentConfiguration": { + "$ref": "#/definitions/AWS::ECS::Service.DeploymentConfiguration" + }, + "DesiredCount": { + "type": "number" + }, + "LoadBalancers": { + "items": { + "$ref": "#/definitions/AWS::ECS::Service.LoadBalancer" + }, + "type": "array" + }, + "PlacementConstraints": { + "items": { + "$ref": "#/definitions/AWS::ECS::Service.PlacementConstraint" + }, + "type": "array" + }, + "PlacementStrategies": { + "items": { + "$ref": "#/definitions/AWS::ECS::Service.PlacementStrategy" + }, + "type": "array" + }, + "Role": { + "type": "string" + }, + "ServiceName": { + "type": "string" + }, + "TaskDefinition": { + "type": "string" + } + }, + "required": [ + "TaskDefinition" + ], + "type": "object" + }, + "AWS::ECS::Service.DeploymentConfiguration": { + "properties": { + "MaximumPercent": { + "type": "number" + }, + "MinimumHealthyPercent": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::ECS::Service.LoadBalancer": { + "properties": { + "ContainerName": { + "type": "string" + }, + "ContainerPort": { + "type": "number" + }, + "LoadBalancerName": { + "type": "string" + }, + "TargetGroupArn": { + "type": "string" + } + }, + "required": [ + "ContainerPort" + ], + "type": "object" + }, + "AWS::ECS::Service.PlacementConstraint": { + "properties": { + "Expression": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::ECS::Service.PlacementStrategy": { + "properties": { + "Field": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::ECS::TaskDefinition": { + "properties": { + "ContainerDefinitions": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.ContainerDefinition" + }, + "type": "array" + }, + "Family": { + "type": "string" + }, + "NetworkMode": { + "type": "string" + }, + "PlacementConstraints": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.TaskDefinitionPlacementConstraint" + }, + "type": "array" + }, + "TaskRoleArn": { + "type": "string" + }, + "Volumes": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.Volume" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::ECS::TaskDefinition.ContainerDefinition": { + "properties": { + "Command": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Cpu": { + "type": "number" + }, + "DisableNetworking": { + "type": "boolean" + }, + "DnsSearchDomains": { + "items": { + "type": "string" + }, + "type": "array" + }, + "DnsServers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "DockerLabels": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "DockerSecurityOptions": { + "items": { + "type": "string" + }, + "type": "array" + }, + "EntryPoint": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Environment": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.KeyValuePair" + }, + "type": "array" + }, + "Essential": { + "type": "boolean" + }, + "ExtraHosts": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.HostEntry" + }, + "type": "array" + }, + "Hostname": { + "type": "string" + }, + "Image": { + "type": "string" + }, + "Links": { + "items": { + "type": "string" + }, + "type": "array" + }, + "LogConfiguration": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.LogConfiguration" + }, + "Memory": { + "type": "number" + }, + "MemoryReservation": { + "type": "number" + }, + "MountPoints": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.MountPoint" + }, + "type": "array" + }, + "Name": { + "type": "string" + }, + "PortMappings": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.PortMapping" + }, + "type": "array" + }, + "Privileged": { + "type": "boolean" + }, + "ReadonlyRootFilesystem": { + "type": "boolean" + }, + "Ulimits": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.Ulimit" + }, + "type": "array" + }, + "User": { + "type": "string" + }, + "VolumesFrom": { + "items": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.VolumeFrom" + }, + "type": "array" + }, + "WorkingDirectory": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ECS::TaskDefinition.HostEntry": { + "properties": { + "Hostname": { + "type": "string" + }, + "IpAddress": { + "type": "string" + } + }, + "required": [ + "Hostname", + "IpAddress" + ], + "type": "object" + }, + "AWS::ECS::TaskDefinition.HostVolumeProperties": { + "properties": { + "SourcePath": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ECS::TaskDefinition.KeyValuePair": { + "properties": { + "Name": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ECS::TaskDefinition.LogConfiguration": { + "properties": { + "LogDriver": { + "type": "string" + }, + "Options": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "LogDriver" + ], + "type": "object" + }, + "AWS::ECS::TaskDefinition.MountPoint": { + "properties": { + "ContainerPath": { + "type": "string" + }, + "ReadOnly": { + "type": "boolean" + }, + "SourceVolume": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ECS::TaskDefinition.PortMapping": { + "properties": { + "ContainerPort": { + "type": "number" + }, + "HostPort": { + "type": "number" + }, + "Protocol": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ECS::TaskDefinition.TaskDefinitionPlacementConstraint": { + "properties": { + "Expression": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::ECS::TaskDefinition.Ulimit": { + "properties": { + "HardLimit": { + "type": "number" + }, + "Name": { + "type": "string" + }, + "SoftLimit": { + "type": "number" + } + }, + "required": [ + "HardLimit", + "Name", + "SoftLimit" + ], + "type": "object" + }, + "AWS::ECS::TaskDefinition.Volume": { + "properties": { + "Host": { + "$ref": "#/definitions/AWS::ECS::TaskDefinition.HostVolumeProperties" + }, + "Name": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ECS::TaskDefinition.VolumeFrom": { + "properties": { + "ReadOnly": { + "type": "boolean" + }, + "SourceContainer": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EFS::FileSystem": { + "properties": { + "FileSystemTags": { + "items": { + "$ref": "#/definitions/AWS::EFS::FileSystem.ElasticFileSystemTag" + }, + "type": "array" + }, + "PerformanceMode": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EFS::FileSystem.ElasticFileSystemTag": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + }, + "AWS::EFS::MountTarget": { + "properties": { + "FileSystemId": { + "type": "string" + }, + "IpAddress": { + "type": "string" + }, + "SecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SubnetId": { + "type": "string" + } + }, + "required": [ + "FileSystemId", + "SecurityGroups", + "SubnetId" + ], + "type": "object" + }, + "AWS::EMR::Cluster": { + "properties": { + "AdditionalInfo": { + "type": "object" + }, + "Applications": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.Application" + }, + "type": "array" + }, + "AutoScalingRole": { + "type": "string" + }, + "BootstrapActions": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.BootstrapActionConfig" + }, + "type": "array" + }, + "Configurations": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.Configuration" + }, + "type": "array" + }, + "Instances": { + "$ref": "#/definitions/AWS::EMR::Cluster.JobFlowInstancesConfig" + }, + "JobFlowRole": { + "type": "string" + }, + "LogUri": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "ReleaseLabel": { + "type": "string" + }, + "ScaleDownBehavior": { + "type": "string" + }, + "SecurityConfiguration": { + "type": "string" + }, + "ServiceRole": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VisibleToAllUsers": { + "type": "boolean" + } + }, + "required": [ + "Instances", + "JobFlowRole", + "Name", + "ServiceRole" + ], + "type": "object" + }, + "AWS::EMR::Cluster.Application": { + "properties": { + "AdditionalInfo": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Args": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Name": { + "type": "string" + }, + "Version": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::EMR::Cluster.AutoScalingPolicy": { + "properties": { + "Constraints": { + "$ref": "#/definitions/AWS::EMR::Cluster.ScalingConstraints" + }, + "Rules": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.ScalingRule" + }, + "type": "array" + } + }, + "required": [ + "Constraints", + "Rules" + ], + "type": "object" + }, + "AWS::EMR::Cluster.BootstrapActionConfig": { + "properties": { + "Name": { + "type": "string" + }, + "ScriptBootstrapAction": { + "$ref": "#/definitions/AWS::EMR::Cluster.ScriptBootstrapActionConfig" + } + }, + "required": [ + "Name", + "ScriptBootstrapAction" + ], + "type": "object" + }, + "AWS::EMR::Cluster.CloudWatchAlarmDefinition": { + "properties": { + "ComparisonOperator": { + "type": "string" + }, + "Dimensions": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.MetricDimension" + }, + "type": "array" + }, + "EvaluationPeriods": { + "type": "number" + }, + "MetricName": { + "type": "string" + }, + "Namespace": { + "type": "string" + }, + "Period": { + "type": "number" + }, + "Statistic": { + "type": "string" + }, + "Threshold": { + "type": "number" + }, + "Unit": { + "type": "string" + } + }, + "required": [ + "ComparisonOperator", + "MetricName", + "Period", + "Threshold" + ], + "type": "object" + }, + "AWS::EMR::Cluster.Configuration": { + "properties": { + "Classification": { + "type": "string" + }, + "ConfigurationProperties": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Configurations": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.Configuration" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::EMR::Cluster.EbsBlockDeviceConfig": { + "properties": { + "VolumeSpecification": { + "$ref": "#/definitions/AWS::EMR::Cluster.VolumeSpecification" + }, + "VolumesPerInstance": { + "type": "number" + } + }, + "required": [ + "VolumeSpecification" + ], + "type": "object" + }, + "AWS::EMR::Cluster.EbsConfiguration": { + "properties": { + "EbsBlockDeviceConfigs": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.EbsBlockDeviceConfig" + }, + "type": "array" + }, + "EbsOptimized": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::EMR::Cluster.InstanceFleetConfig": { + "properties": { + "InstanceTypeConfigs": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.InstanceTypeConfig" + }, + "type": "array" + }, + "LaunchSpecifications": { + "$ref": "#/definitions/AWS::EMR::Cluster.InstanceFleetProvisioningSpecifications" + }, + "Name": { + "type": "string" + }, + "TargetOnDemandCapacity": { + "type": "number" + }, + "TargetSpotCapacity": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::EMR::Cluster.InstanceFleetProvisioningSpecifications": { + "properties": { + "SpotSpecification": { + "$ref": "#/definitions/AWS::EMR::Cluster.SpotProvisioningSpecification" + } + }, + "required": [ + "SpotSpecification" + ], + "type": "object" + }, + "AWS::EMR::Cluster.InstanceGroupConfig": { + "properties": { + "AutoScalingPolicy": { + "$ref": "#/definitions/AWS::EMR::Cluster.AutoScalingPolicy" + }, + "BidPrice": { + "type": "string" + }, + "Configurations": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.Configuration" + }, + "type": "array" + }, + "EbsConfiguration": { + "$ref": "#/definitions/AWS::EMR::Cluster.EbsConfiguration" + }, + "InstanceCount": { + "type": "number" + }, + "InstanceType": { + "type": "string" + }, + "Market": { + "type": "string" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "InstanceCount", + "InstanceType" + ], + "type": "object" + }, + "AWS::EMR::Cluster.InstanceTypeConfig": { + "properties": { + "BidPrice": { + "type": "string" + }, + "BidPriceAsPercentageOfOnDemandPrice": { + "type": "number" + }, + "Configurations": { + "items": { + "$ref": "#/definitions/AWS::EMR::Cluster.Configuration" + }, + "type": "array" + }, + "EbsConfiguration": { + "$ref": "#/definitions/AWS::EMR::Cluster.EbsConfiguration" + }, + "InstanceType": { + "type": "string" + }, + "WeightedCapacity": { + "type": "number" + } + }, + "required": [ + "InstanceType" + ], + "type": "object" + }, + "AWS::EMR::Cluster.JobFlowInstancesConfig": { + "properties": { + "AdditionalMasterSecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "AdditionalSlaveSecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "CoreInstanceFleet": { + "$ref": "#/definitions/AWS::EMR::Cluster.InstanceFleetConfig" + }, + "CoreInstanceGroup": { + "$ref": "#/definitions/AWS::EMR::Cluster.InstanceGroupConfig" + }, + "Ec2KeyName": { + "type": "string" + }, + "Ec2SubnetId": { + "type": "string" + }, + "EmrManagedMasterSecurityGroup": { + "type": "string" + }, + "EmrManagedSlaveSecurityGroup": { + "type": "string" + }, + "HadoopVersion": { + "type": "string" + }, + "MasterInstanceFleet": { + "$ref": "#/definitions/AWS::EMR::Cluster.InstanceFleetConfig" + }, + "MasterInstanceGroup": { + "$ref": "#/definitions/AWS::EMR::Cluster.InstanceGroupConfig" + }, + "Placement": { + "$ref": "#/definitions/AWS::EMR::Cluster.PlacementType" + }, + "ServiceAccessSecurityGroup": { + "type": "string" + }, + "TerminationProtected": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::EMR::Cluster.MetricDimension": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + }, + "AWS::EMR::Cluster.PlacementType": { + "properties": { + "AvailabilityZone": { + "type": "string" + } + }, + "required": [ + "AvailabilityZone" + ], + "type": "object" + }, + "AWS::EMR::Cluster.ScalingAction": { + "properties": { + "Market": { + "type": "string" + }, + "SimpleScalingPolicyConfiguration": { + "$ref": "#/definitions/AWS::EMR::Cluster.SimpleScalingPolicyConfiguration" + } + }, + "required": [ + "SimpleScalingPolicyConfiguration" + ], + "type": "object" + }, + "AWS::EMR::Cluster.ScalingConstraints": { + "properties": { + "MaxCapacity": { + "type": "number" + }, + "MinCapacity": { + "type": "number" + } + }, + "required": [ + "MaxCapacity", + "MinCapacity" + ], + "type": "object" + }, + "AWS::EMR::Cluster.ScalingRule": { + "properties": { + "Action": { + "$ref": "#/definitions/AWS::EMR::Cluster.ScalingAction" + }, + "Description": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Trigger": { + "$ref": "#/definitions/AWS::EMR::Cluster.ScalingTrigger" + } + }, + "required": [ + "Action", + "Name", + "Trigger" + ], + "type": "object" + }, + "AWS::EMR::Cluster.ScalingTrigger": { + "properties": { + "CloudWatchAlarmDefinition": { + "$ref": "#/definitions/AWS::EMR::Cluster.CloudWatchAlarmDefinition" + } + }, + "required": [ + "CloudWatchAlarmDefinition" + ], + "type": "object" + }, + "AWS::EMR::Cluster.ScriptBootstrapActionConfig": { + "properties": { + "Args": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Path": { + "type": "string" + } + }, + "required": [ + "Path" + ], + "type": "object" + }, + "AWS::EMR::Cluster.SimpleScalingPolicyConfiguration": { + "properties": { + "AdjustmentType": { + "type": "string" + }, + "CoolDown": { + "type": "number" + }, + "ScalingAdjustment": { + "type": "number" + } + }, + "required": [ + "ScalingAdjustment" + ], + "type": "object" + }, + "AWS::EMR::Cluster.SpotProvisioningSpecification": { + "properties": { + "BlockDurationMinutes": { + "type": "number" + }, + "TimeoutAction": { + "type": "string" + }, + "TimeoutDurationMinutes": { + "type": "number" + } + }, + "required": [ + "TimeoutAction", + "TimeoutDurationMinutes" + ], + "type": "object" + }, + "AWS::EMR::Cluster.VolumeSpecification": { + "properties": { + "Iops": { + "type": "number" + }, + "SizeInGB": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "required": [ + "SizeInGB", + "VolumeType" + ], + "type": "object" + }, + "AWS::EMR::InstanceFleetConfig": { + "properties": { + "ClusterId": { + "type": "string" + }, + "InstanceFleetType": { + "type": "string" + }, + "InstanceTypeConfigs": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig.InstanceTypeConfig" + }, + "type": "array" + }, + "LaunchSpecifications": { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig.InstanceFleetProvisioningSpecifications" + }, + "Name": { + "type": "string" + }, + "TargetOnDemandCapacity": { + "type": "number" + }, + "TargetSpotCapacity": { + "type": "number" + } + }, + "required": [ + "ClusterId", + "InstanceFleetType" + ], + "type": "object" + }, + "AWS::EMR::InstanceFleetConfig.Configuration": { + "properties": { + "Classification": { + "type": "string" + }, + "ConfigurationProperties": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Configurations": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig.Configuration" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::EMR::InstanceFleetConfig.EbsBlockDeviceConfig": { + "properties": { + "VolumeSpecification": { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig.VolumeSpecification" + }, + "VolumesPerInstance": { + "type": "number" + } + }, + "required": [ + "VolumeSpecification" + ], + "type": "object" + }, + "AWS::EMR::InstanceFleetConfig.EbsConfiguration": { + "properties": { + "EbsBlockDeviceConfigs": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig.EbsBlockDeviceConfig" + }, + "type": "array" + }, + "EbsOptimized": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::EMR::InstanceFleetConfig.InstanceFleetProvisioningSpecifications": { + "properties": { + "SpotSpecification": { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig.SpotProvisioningSpecification" + } + }, + "required": [ + "SpotSpecification" + ], + "type": "object" + }, + "AWS::EMR::InstanceFleetConfig.InstanceTypeConfig": { + "properties": { + "BidPrice": { + "type": "string" + }, + "BidPriceAsPercentageOfOnDemandPrice": { + "type": "number" + }, + "Configurations": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig.Configuration" + }, + "type": "array" + }, + "EbsConfiguration": { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig.EbsConfiguration" + }, + "InstanceType": { + "type": "string" + }, + "WeightedCapacity": { + "type": "number" + } + }, + "required": [ + "InstanceType" + ], + "type": "object" + }, + "AWS::EMR::InstanceFleetConfig.SpotProvisioningSpecification": { + "properties": { + "BlockDurationMinutes": { + "type": "number" + }, + "TimeoutAction": { + "type": "string" + }, + "TimeoutDurationMinutes": { + "type": "number" + } + }, + "required": [ + "TimeoutAction", + "TimeoutDurationMinutes" + ], + "type": "object" + }, + "AWS::EMR::InstanceFleetConfig.VolumeSpecification": { + "properties": { + "Iops": { + "type": "number" + }, + "SizeInGB": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "required": [ + "SizeInGB", + "VolumeType" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig": { + "properties": { + "AutoScalingPolicy": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.AutoScalingPolicy" + }, + "BidPrice": { + "type": "string" + }, + "Configurations": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.Configuration" + }, + "type": "array" + }, + "EbsConfiguration": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.EbsConfiguration" + }, + "InstanceCount": { + "type": "number" + }, + "InstanceRole": { + "type": "string" + }, + "InstanceType": { + "type": "string" + }, + "JobFlowId": { + "type": "string" + }, + "Market": { + "type": "string" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "InstanceCount", + "InstanceRole", + "InstanceType", + "JobFlowId" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.AutoScalingPolicy": { + "properties": { + "Constraints": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.ScalingConstraints" + }, + "Rules": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.ScalingRule" + }, + "type": "array" + } + }, + "required": [ + "Constraints", + "Rules" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.CloudWatchAlarmDefinition": { + "properties": { + "ComparisonOperator": { + "type": "string" + }, + "Dimensions": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.MetricDimension" + }, + "type": "array" + }, + "EvaluationPeriods": { + "type": "number" + }, + "MetricName": { + "type": "string" + }, + "Namespace": { + "type": "string" + }, + "Period": { + "type": "number" + }, + "Statistic": { + "type": "string" + }, + "Threshold": { + "type": "number" + }, + "Unit": { + "type": "string" + } + }, + "required": [ + "ComparisonOperator", + "MetricName", + "Period", + "Threshold" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.Configuration": { + "properties": { + "Classification": { + "type": "string" + }, + "ConfigurationProperties": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Configurations": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.Configuration" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.EbsBlockDeviceConfig": { + "properties": { + "VolumeSpecification": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.VolumeSpecification" + }, + "VolumesPerInstance": { + "type": "number" + } + }, + "required": [ + "VolumeSpecification" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.EbsConfiguration": { + "properties": { + "EbsBlockDeviceConfigs": { + "items": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.EbsBlockDeviceConfig" + }, + "type": "array" + }, + "EbsOptimized": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.MetricDimension": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.ScalingAction": { + "properties": { + "Market": { + "type": "string" + }, + "SimpleScalingPolicyConfiguration": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.SimpleScalingPolicyConfiguration" + } + }, + "required": [ + "SimpleScalingPolicyConfiguration" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.ScalingConstraints": { + "properties": { + "MaxCapacity": { + "type": "number" + }, + "MinCapacity": { + "type": "number" + } + }, + "required": [ + "MaxCapacity", + "MinCapacity" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.ScalingRule": { + "properties": { + "Action": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.ScalingAction" + }, + "Description": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Trigger": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.ScalingTrigger" + } + }, + "required": [ + "Action", + "Name", + "Trigger" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.ScalingTrigger": { + "properties": { + "CloudWatchAlarmDefinition": { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig.CloudWatchAlarmDefinition" + } + }, + "required": [ + "CloudWatchAlarmDefinition" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.SimpleScalingPolicyConfiguration": { + "properties": { + "AdjustmentType": { + "type": "string" + }, + "CoolDown": { + "type": "number" + }, + "ScalingAdjustment": { + "type": "number" + } + }, + "required": [ + "ScalingAdjustment" + ], + "type": "object" + }, + "AWS::EMR::InstanceGroupConfig.VolumeSpecification": { + "properties": { + "Iops": { + "type": "number" + }, + "SizeInGB": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "required": [ + "SizeInGB", + "VolumeType" + ], + "type": "object" + }, + "AWS::EMR::SecurityConfiguration": { + "properties": { + "Name": { + "type": "string" + }, + "SecurityConfiguration": { + "type": "object" + } + }, + "required": [ + "SecurityConfiguration" + ], + "type": "object" + }, + "AWS::EMR::Step": { + "properties": { + "ActionOnFailure": { + "type": "string" + }, + "HadoopJarStep": { + "$ref": "#/definitions/AWS::EMR::Step.HadoopJarStepConfig" + }, + "JobFlowId": { + "type": "string" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "ActionOnFailure", + "HadoopJarStep", + "JobFlowId", + "Name" + ], + "type": "object" + }, + "AWS::EMR::Step.HadoopJarStepConfig": { + "properties": { + "Args": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Jar": { + "type": "string" + }, + "MainClass": { + "type": "string" + }, + "StepProperties": { + "items": { + "$ref": "#/definitions/AWS::EMR::Step.KeyValue" + }, + "type": "array" + } + }, + "required": [ + "Jar" + ], + "type": "object" + }, + "AWS::EMR::Step.KeyValue": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ElastiCache::CacheCluster": { + "properties": { + "AZMode": { + "type": "string" + }, + "AutoMinorVersionUpgrade": { + "type": "boolean" + }, + "CacheNodeType": { + "type": "string" + }, + "CacheParameterGroupName": { + "type": "string" + }, + "CacheSecurityGroupNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "CacheSubnetGroupName": { + "type": "string" + }, + "ClusterName": { + "type": "string" + }, + "Engine": { + "type": "string" + }, + "EngineVersion": { + "type": "string" + }, + "NotificationTopicArn": { + "type": "string" + }, + "NumCacheNodes": { + "type": "number" + }, + "Port": { + "type": "number" + }, + "PreferredAvailabilityZone": { + "type": "string" + }, + "PreferredAvailabilityZones": { + "items": { + "type": "string" + }, + "type": "array" + }, + "PreferredMaintenanceWindow": { + "type": "string" + }, + "SnapshotArns": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SnapshotName": { + "type": "string" + }, + "SnapshotRetentionLimit": { + "type": "number" + }, + "SnapshotWindow": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcSecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "CacheNodeType", + "Engine", + "NumCacheNodes" + ], + "type": "object" + }, + "AWS::ElastiCache::ParameterGroup": { + "properties": { + "CacheParameterGroupFamily": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "Properties": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "CacheParameterGroupFamily", + "Description" + ], + "type": "object" + }, + "AWS::ElastiCache::ReplicationGroup": { + "properties": { + "AutoMinorVersionUpgrade": { + "type": "boolean" + }, + "AutomaticFailoverEnabled": { + "type": "boolean" + }, + "CacheNodeType": { + "type": "string" + }, + "CacheParameterGroupName": { + "type": "string" + }, + "CacheSecurityGroupNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "CacheSubnetGroupName": { + "type": "string" + }, + "Engine": { + "type": "string" + }, + "EngineVersion": { + "type": "string" + }, + "NodeGroupConfiguration": { + "items": { + "$ref": "#/definitions/AWS::ElastiCache::ReplicationGroup.NodeGroupConfiguration" + }, + "type": "array" + }, + "NotificationTopicArn": { + "type": "string" + }, + "NumCacheClusters": { + "type": "number" + }, + "NumNodeGroups": { + "type": "number" + }, + "Port": { + "type": "number" + }, + "PreferredCacheClusterAZs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "PreferredMaintenanceWindow": { + "type": "string" + }, + "PrimaryClusterId": { + "type": "string" + }, + "ReplicasPerNodeGroup": { + "type": "number" + }, + "ReplicationGroupDescription": { + "type": "string" + }, + "ReplicationGroupId": { + "type": "string" + }, + "SecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SnapshotArns": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SnapshotName": { + "type": "string" + }, + "SnapshotRetentionLimit": { + "type": "number" + }, + "SnapshotWindow": { + "type": "string" + }, + "SnapshottingClusterId": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "ReplicationGroupDescription" + ], + "type": "object" + }, + "AWS::ElastiCache::ReplicationGroup.NodeGroupConfiguration": { + "properties": { + "PrimaryAvailabilityZone": { + "type": "string" + }, + "ReplicaAvailabilityZones": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ReplicaCount": { + "type": "number" + }, + "Slots": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ElastiCache::SecurityGroup": { + "properties": { + "Description": { + "type": "string" + } + }, + "required": [ + "Description" + ], + "type": "object" + }, + "AWS::ElastiCache::SecurityGroupIngress": { + "properties": { + "CacheSecurityGroupName": { + "type": "string" + }, + "EC2SecurityGroupName": { + "type": "string" + }, + "EC2SecurityGroupOwnerId": { + "type": "string" + } + }, + "required": [ + "CacheSecurityGroupName", + "EC2SecurityGroupName" + ], + "type": "object" + }, + "AWS::ElastiCache::SubnetGroup": { + "properties": { + "CacheSubnetGroupName": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "SubnetIds": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "Description", + "SubnetIds" + ], + "type": "object" + }, + "AWS::ElasticBeanstalk::Application": { + "properties": { + "ApplicationName": { + "type": "string" + }, + "Description": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ElasticBeanstalk::ApplicationVersion": { + "properties": { + "ApplicationName": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "SourceBundle": { + "$ref": "#/definitions/AWS::ElasticBeanstalk::ApplicationVersion.SourceBundle" + } + }, + "required": [ + "ApplicationName", + "SourceBundle" + ], + "type": "object" + }, + "AWS::ElasticBeanstalk::ApplicationVersion.SourceBundle": { + "properties": { + "S3Bucket": { + "type": "string" + }, + "S3Key": { + "type": "string" + } + }, + "required": [ + "S3Bucket", + "S3Key" + ], + "type": "object" + }, + "AWS::ElasticBeanstalk::ConfigurationTemplate": { + "properties": { + "ApplicationName": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "EnvironmentId": { + "type": "string" + }, + "OptionSettings": { + "items": { + "$ref": "#/definitions/AWS::ElasticBeanstalk::ConfigurationTemplate.ConfigurationOptionSetting" + }, + "type": "array" + }, + "SolutionStackName": { + "type": "string" + }, + "SourceConfiguration": { + "$ref": "#/definitions/AWS::ElasticBeanstalk::ConfigurationTemplate.SourceConfiguration" + } + }, + "required": [ + "ApplicationName" + ], + "type": "object" + }, + "AWS::ElasticBeanstalk::ConfigurationTemplate.ConfigurationOptionSetting": { + "properties": { + "Namespace": { + "type": "string" + }, + "OptionName": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Namespace", + "OptionName", + "Value" + ], + "type": "object" + }, + "AWS::ElasticBeanstalk::ConfigurationTemplate.SourceConfiguration": { + "properties": { + "ApplicationName": { + "type": "string" + }, + "TemplateName": { + "type": "string" + } + }, + "required": [ + "ApplicationName", + "TemplateName" + ], + "type": "object" + }, + "AWS::ElasticBeanstalk::Environment": { + "properties": { + "ApplicationName": { + "type": "string" + }, + "CNAMEPrefix": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "EnvironmentName": { + "type": "string" + }, + "OptionSettings": { + "items": { + "$ref": "#/definitions/AWS::ElasticBeanstalk::Environment.OptionSettings" + }, + "type": "array" + }, + "SolutionStackName": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "TemplateName": { + "type": "string" + }, + "Tier": { + "$ref": "#/definitions/AWS::ElasticBeanstalk::Environment.Tier" + }, + "VersionLabel": { + "type": "string" + } + }, + "required": [ + "ApplicationName" + ], + "type": "object" + }, + "AWS::ElasticBeanstalk::Environment.OptionSettings": { + "properties": { + "Namespace": { + "type": "string" + }, + "OptionName": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Namespace", + "OptionName", + "Value" + ], + "type": "object" + }, + "AWS::ElasticBeanstalk::Environment.Tier": { + "properties": { + "Name": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Version": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer": { + "properties": { + "AccessLoggingPolicy": { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer.AccessLoggingPolicy" + }, + "AppCookieStickinessPolicy": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer.AppCookieStickinessPolicy" + }, + "type": "array" + }, + "AvailabilityZones": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ConnectionDrainingPolicy": { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer.ConnectionDrainingPolicy" + }, + "ConnectionSettings": { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer.ConnectionSettings" + }, + "CrossZone": { + "type": "boolean" + }, + "HealthCheck": { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer.HealthCheck" + }, + "Instances": { + "items": { + "type": "string" + }, + "type": "array" + }, + "LBCookieStickinessPolicy": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer.LBCookieStickinessPolicy" + }, + "type": "array" + }, + "Listeners": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer.Listeners" + }, + "type": "array" + }, + "LoadBalancerName": { + "type": "string" + }, + "Policies": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer.Policies" + }, + "type": "array" + }, + "Scheme": { + "type": "string" + }, + "SecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Subnets": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "Listeners" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer.AccessLoggingPolicy": { + "properties": { + "EmitInterval": { + "type": "number" + }, + "Enabled": { + "type": "boolean" + }, + "S3BucketName": { + "type": "string" + }, + "S3BucketPrefix": { + "type": "string" + } + }, + "required": [ + "Enabled", + "S3BucketName" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer.AppCookieStickinessPolicy": { + "properties": { + "CookieName": { + "type": "string" + }, + "PolicyName": { + "type": "string" + } + }, + "required": [ + "CookieName", + "PolicyName" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer.ConnectionDrainingPolicy": { + "properties": { + "Enabled": { + "type": "boolean" + }, + "Timeout": { + "type": "number" + } + }, + "required": [ + "Enabled" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer.ConnectionSettings": { + "properties": { + "IdleTimeout": { + "type": "number" + } + }, + "required": [ + "IdleTimeout" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer.HealthCheck": { + "properties": { + "HealthyThreshold": { + "type": "string" + }, + "Interval": { + "type": "string" + }, + "Target": { + "type": "string" + }, + "Timeout": { + "type": "string" + }, + "UnhealthyThreshold": { + "type": "string" + } + }, + "required": [ + "HealthyThreshold", + "Interval", + "Target", + "Timeout", + "UnhealthyThreshold" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer.LBCookieStickinessPolicy": { + "properties": { + "CookieExpirationPeriod": { + "type": "string" + }, + "PolicyName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer.Listeners": { + "properties": { + "InstancePort": { + "type": "string" + }, + "InstanceProtocol": { + "type": "string" + }, + "LoadBalancerPort": { + "type": "string" + }, + "PolicyNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Protocol": { + "type": "string" + }, + "SSLCertificateId": { + "type": "string" + } + }, + "required": [ + "InstancePort", + "LoadBalancerPort", + "Protocol" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancing::LoadBalancer.Policies": { + "properties": { + "Attributes": { + "items": { + "type": "object" + }, + "type": "array" + }, + "InstancePorts": { + "items": { + "type": "string" + }, + "type": "array" + }, + "LoadBalancerPorts": { + "items": { + "type": "string" + }, + "type": "array" + }, + "PolicyName": { + "type": "string" + }, + "PolicyType": { + "type": "string" + } + }, + "required": [ + "Attributes", + "PolicyName", + "PolicyType" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::Listener": { + "properties": { + "Certificates": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::Listener.Certificate" + }, + "type": "array" + }, + "DefaultActions": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::Listener.Action" + }, + "type": "array" + }, + "LoadBalancerArn": { + "type": "string" + }, + "Port": { + "type": "number" + }, + "Protocol": { + "type": "string" + }, + "SslPolicy": { + "type": "string" + } + }, + "required": [ + "DefaultActions", + "LoadBalancerArn", + "Port", + "Protocol" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::Listener.Action": { + "properties": { + "TargetGroupArn": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "TargetGroupArn", + "Type" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::Listener.Certificate": { + "properties": { + "CertificateArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::ListenerRule": { + "properties": { + "Actions": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::ListenerRule.Action" + }, + "type": "array" + }, + "Conditions": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::ListenerRule.RuleCondition" + }, + "type": "array" + }, + "ListenerArn": { + "type": "string" + }, + "Priority": { + "type": "number" + } + }, + "required": [ + "Actions", + "Conditions", + "ListenerArn", + "Priority" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::ListenerRule.Action": { + "properties": { + "TargetGroupArn": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "TargetGroupArn", + "Type" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::ListenerRule.RuleCondition": { + "properties": { + "Field": { + "type": "string" + }, + "Values": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::LoadBalancer": { + "properties": { + "IpAddressType": { + "type": "string" + }, + "LoadBalancerAttributes": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::LoadBalancer.LoadBalancerAttribute" + }, + "type": "array" + }, + "Name": { + "type": "string" + }, + "Scheme": { + "type": "string" + }, + "SecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Subnets": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::LoadBalancer.LoadBalancerAttribute": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::TargetGroup": { + "properties": { + "HealthCheckIntervalSeconds": { + "type": "number" + }, + "HealthCheckPath": { + "type": "string" + }, + "HealthCheckPort": { + "type": "string" + }, + "HealthCheckProtocol": { + "type": "string" + }, + "HealthCheckTimeoutSeconds": { + "type": "number" + }, + "HealthyThresholdCount": { + "type": "number" + }, + "Matcher": { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::TargetGroup.Matcher" + }, + "Name": { + "type": "string" + }, + "Port": { + "type": "number" + }, + "Protocol": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "TargetGroupAttributes": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::TargetGroup.TargetGroupAttribute" + }, + "type": "array" + }, + "Targets": { + "items": { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescription" + }, + "type": "array" + }, + "UnhealthyThresholdCount": { + "type": "number" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "Port", + "Protocol", + "VpcId" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::TargetGroup.Matcher": { + "properties": { + "HttpCode": { + "type": "string" + } + }, + "required": [ + "HttpCode" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescription": { + "properties": { + "Id": { + "type": "string" + }, + "Port": { + "type": "number" + } + }, + "required": [ + "Id" + ], + "type": "object" + }, + "AWS::ElasticLoadBalancingV2::TargetGroup.TargetGroupAttribute": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Elasticsearch::Domain": { + "properties": { + "AccessPolicies": { + "type": "object" + }, + "AdvancedOptions": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "DomainName": { + "type": "string" + }, + "EBSOptions": { + "$ref": "#/definitions/AWS::Elasticsearch::Domain.EBSOptions" + }, + "ElasticsearchClusterConfig": { + "$ref": "#/definitions/AWS::Elasticsearch::Domain.ElasticsearchClusterConfig" + }, + "ElasticsearchVersion": { + "type": "string" + }, + "SnapshotOptions": { + "$ref": "#/definitions/AWS::Elasticsearch::Domain.SnapshotOptions" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::Elasticsearch::Domain.EBSOptions": { + "properties": { + "EBSEnabled": { + "type": "boolean" + }, + "Iops": { + "type": "number" + }, + "VolumeSize": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Elasticsearch::Domain.ElasticsearchClusterConfig": { + "properties": { + "DedicatedMasterCount": { + "type": "number" + }, + "DedicatedMasterEnabled": { + "type": "boolean" + }, + "DedicatedMasterType": { + "type": "string" + }, + "InstanceCount": { + "type": "number" + }, + "InstanceType": { + "type": "string" + }, + "ZoneAwarenessEnabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::Elasticsearch::Domain.SnapshotOptions": { + "properties": { + "AutomatedSnapshotStartHour": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::Events::Rule": { + "properties": { + "Description": { + "type": "string" + }, + "EventPattern": { + "type": "object" + }, + "Name": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "ScheduleExpression": { + "type": "string" + }, + "State": { + "type": "string" + }, + "Targets": { + "items": { + "$ref": "#/definitions/AWS::Events::Rule.Target" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::Events::Rule.Target": { + "properties": { + "Arn": { + "type": "string" + }, + "Id": { + "type": "string" + }, + "Input": { + "type": "string" + }, + "InputPath": { + "type": "string" + }, + "RoleArn": { + "type": "string" + } + }, + "required": [ + "Arn", + "Id" + ], + "type": "object" + }, + "AWS::GameLift::Alias": { + "properties": { + "Description": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "RoutingStrategy": { + "$ref": "#/definitions/AWS::GameLift::Alias.RoutingStrategy" + } + }, + "required": [ + "Name", + "RoutingStrategy" + ], + "type": "object" + }, + "AWS::GameLift::Alias.RoutingStrategy": { + "properties": { + "FleetId": { + "type": "string" + }, + "Message": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::GameLift::Build": { + "properties": { + "Name": { + "type": "string" + }, + "StorageLocation": { + "$ref": "#/definitions/AWS::GameLift::Build.S3Location" + }, + "Version": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::GameLift::Build.S3Location": { + "properties": { + "Bucket": { + "type": "string" + }, + "Key": { + "type": "string" + }, + "RoleArn": { + "type": "string" + } + }, + "required": [ + "Bucket", + "Key", + "RoleArn" + ], + "type": "object" + }, + "AWS::GameLift::Fleet": { + "properties": { + "BuildId": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "DesiredEC2Instances": { + "type": "number" + }, + "EC2InboundPermissions": { + "items": { + "$ref": "#/definitions/AWS::GameLift::Fleet.IpPermission" + }, + "type": "array" + }, + "EC2InstanceType": { + "type": "string" + }, + "LogPaths": { + "items": { + "type": "string" + }, + "type": "array" + }, + "MaxSize": { + "type": "number" + }, + "MinSize": { + "type": "number" + }, + "Name": { + "type": "string" + }, + "ServerLaunchParameters": { + "type": "string" + }, + "ServerLaunchPath": { + "type": "string" + } + }, + "required": [ + "BuildId", + "DesiredEC2Instances", + "EC2InstanceType", + "Name", + "ServerLaunchPath" + ], + "type": "object" + }, + "AWS::GameLift::Fleet.IpPermission": { + "properties": { + "FromPort": { + "type": "number" + }, + "IpRange": { + "type": "string" + }, + "Protocol": { + "type": "string" + }, + "ToPort": { + "type": "number" + } + }, + "required": [ + "FromPort", + "IpRange", + "Protocol", + "ToPort" + ], + "type": "object" + }, + "AWS::IAM::AccessKey": { + "properties": { + "Serial": { + "type": "number" + }, + "Status": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "UserName" + ], + "type": "object" + }, + "AWS::IAM::Group": { + "properties": { + "GroupName": { + "type": "string" + }, + "ManagedPolicyArns": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Path": { + "type": "string" + }, + "Policies": { + "items": { + "$ref": "#/definitions/AWS::IAM::Group.Policy" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::IAM::Group.Policy": { + "properties": { + "PolicyDocument": { + "type": "object" + }, + "PolicyName": { + "type": "string" + } + }, + "required": [ + "PolicyDocument", + "PolicyName" + ], + "type": "object" + }, + "AWS::IAM::InstanceProfile": { + "properties": { + "InstanceProfileName": { + "type": "string" + }, + "Path": { + "type": "string" + }, + "Roles": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "Roles" + ], + "type": "object" + }, + "AWS::IAM::ManagedPolicy": { + "properties": { + "Description": { + "type": "string" + }, + "Groups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ManagedPolicyName": { + "type": "string" + }, + "Path": { + "type": "string" + }, + "PolicyDocument": { + "type": "object" + }, + "Roles": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Users": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "PolicyDocument" + ], + "type": "object" + }, + "AWS::IAM::Policy": { + "properties": { + "Groups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "PolicyDocument": { + "type": "object" + }, + "PolicyName": { + "type": "string" + }, + "Roles": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Users": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "PolicyDocument", + "PolicyName" + ], + "type": "object" + }, + "AWS::IAM::Role": { + "properties": { + "AssumeRolePolicyDocument": { + "type": "object" + }, + "ManagedPolicyArns": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Path": { + "type": "string" + }, + "Policies": { + "items": { + "$ref": "#/definitions/AWS::IAM::Role.Policy" + }, + "type": "array" + }, + "RoleName": { + "type": "string" + } + }, + "required": [ + "AssumeRolePolicyDocument" + ], + "type": "object" + }, + "AWS::IAM::Role.Policy": { + "properties": { + "PolicyDocument": { + "type": "object" + }, + "PolicyName": { + "type": "string" + } + }, + "required": [ + "PolicyDocument", + "PolicyName" + ], + "type": "object" + }, + "AWS::IAM::User": { + "properties": { + "Groups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "LoginProfile": { + "$ref": "#/definitions/AWS::IAM::User.LoginProfile" + }, + "ManagedPolicyArns": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Path": { + "type": "string" + }, + "Policies": { + "items": { + "$ref": "#/definitions/AWS::IAM::User.Policy" + }, + "type": "array" + }, + "UserName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::IAM::User.LoginProfile": { + "properties": { + "Password": { + "type": "string" + }, + "PasswordResetRequired": { + "type": "boolean" + } + }, + "required": [ + "Password" + ], + "type": "object" + }, + "AWS::IAM::User.Policy": { + "properties": { + "PolicyDocument": { + "type": "object" + }, + "PolicyName": { + "type": "string" + } + }, + "required": [ + "PolicyDocument", + "PolicyName" + ], + "type": "object" + }, + "AWS::IAM::UserToGroupAddition": { + "properties": { + "GroupName": { + "type": "string" + }, + "Users": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "GroupName", + "Users" + ], + "type": "object" + }, + "AWS::IoT::Certificate": { + "properties": { + "CertificateSigningRequest": { + "type": "string" + }, + "Status": { + "type": "string" + } + }, + "required": [ + "CertificateSigningRequest", + "Status" + ], + "type": "object" + }, + "AWS::IoT::Policy": { + "properties": { + "PolicyDocument": { + "type": "object" + }, + "PolicyName": { + "type": "string" + } + }, + "required": [ + "PolicyDocument" + ], + "type": "object" + }, + "AWS::IoT::PolicyPrincipalAttachment": { + "properties": { + "PolicyName": { + "type": "string" + }, + "Principal": { + "type": "string" + } + }, + "required": [ + "PolicyName", + "Principal" + ], + "type": "object" + }, + "AWS::IoT::Thing": { + "properties": { + "AttributePayload": { + "$ref": "#/definitions/AWS::IoT::Thing.AttributePayload" + }, + "ThingName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::IoT::Thing.AttributePayload": { + "properties": { + "Attributes": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "AWS::IoT::ThingPrincipalAttachment": { + "properties": { + "Principal": { + "type": "string" + }, + "ThingName": { + "type": "string" + } + }, + "required": [ + "Principal", + "ThingName" + ], + "type": "object" + }, + "AWS::IoT::TopicRule": { + "properties": { + "RuleName": { + "type": "string" + }, + "TopicRulePayload": { + "$ref": "#/definitions/AWS::IoT::TopicRule.TopicRulePayload" + } + }, + "required": [ + "TopicRulePayload" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.Action": { + "properties": { + "CloudwatchAlarm": { + "$ref": "#/definitions/AWS::IoT::TopicRule.CloudwatchAlarmAction" + }, + "CloudwatchMetric": { + "$ref": "#/definitions/AWS::IoT::TopicRule.CloudwatchMetricAction" + }, + "DynamoDB": { + "$ref": "#/definitions/AWS::IoT::TopicRule.DynamoDBAction" + }, + "Elasticsearch": { + "$ref": "#/definitions/AWS::IoT::TopicRule.ElasticsearchAction" + }, + "Firehose": { + "$ref": "#/definitions/AWS::IoT::TopicRule.FirehoseAction" + }, + "Kinesis": { + "$ref": "#/definitions/AWS::IoT::TopicRule.KinesisAction" + }, + "Lambda": { + "$ref": "#/definitions/AWS::IoT::TopicRule.LambdaAction" + }, + "Republish": { + "$ref": "#/definitions/AWS::IoT::TopicRule.RepublishAction" + }, + "S3": { + "$ref": "#/definitions/AWS::IoT::TopicRule.S3Action" + }, + "Sns": { + "$ref": "#/definitions/AWS::IoT::TopicRule.SnsAction" + }, + "Sqs": { + "$ref": "#/definitions/AWS::IoT::TopicRule.SqsAction" + } + }, + "type": "object" + }, + "AWS::IoT::TopicRule.CloudwatchAlarmAction": { + "properties": { + "AlarmName": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "StateReason": { + "type": "string" + }, + "StateValue": { + "type": "string" + } + }, + "required": [ + "AlarmName", + "RoleArn", + "StateReason", + "StateValue" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.CloudwatchMetricAction": { + "properties": { + "MetricName": { + "type": "string" + }, + "MetricNamespace": { + "type": "string" + }, + "MetricTimestamp": { + "type": "string" + }, + "MetricUnit": { + "type": "string" + }, + "MetricValue": { + "type": "string" + }, + "RoleArn": { + "type": "string" + } + }, + "required": [ + "MetricName", + "MetricNamespace", + "MetricUnit", + "MetricValue", + "RoleArn" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.DynamoDBAction": { + "properties": { + "HashKeyField": { + "type": "string" + }, + "HashKeyValue": { + "type": "string" + }, + "PayloadField": { + "type": "string" + }, + "RangeKeyField": { + "type": "string" + }, + "RangeKeyValue": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "TableName": { + "type": "string" + } + }, + "required": [ + "HashKeyField", + "HashKeyValue", + "RangeKeyField", + "RangeKeyValue", + "RoleArn", + "TableName" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.ElasticsearchAction": { + "properties": { + "Endpoint": { + "type": "string" + }, + "Id": { + "type": "string" + }, + "Index": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Endpoint", + "Id", + "Index", + "RoleArn", + "Type" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.FirehoseAction": { + "properties": { + "DeliveryStreamName": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "Separator": { + "type": "string" + } + }, + "required": [ + "DeliveryStreamName", + "RoleArn" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.KinesisAction": { + "properties": { + "PartitionKey": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "StreamName": { + "type": "string" + } + }, + "required": [ + "RoleArn", + "StreamName" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.LambdaAction": { + "properties": { + "FunctionArn": { + "type": "string" + } + }, + "required": [ + "FunctionArn" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.RepublishAction": { + "properties": { + "RoleArn": { + "type": "string" + }, + "Topic": { + "type": "string" + } + }, + "required": [ + "RoleArn", + "Topic" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.S3Action": { + "properties": { + "BucketName": { + "type": "string" + }, + "Key": { + "type": "string" + }, + "RoleArn": { + "type": "string" + } + }, + "required": [ + "BucketName", + "Key", + "RoleArn" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.SnsAction": { + "properties": { + "MessageFormat": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "TargetArn": { + "type": "string" + } + }, + "required": [ + "RoleArn", + "TargetArn" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.SqsAction": { + "properties": { + "QueueUrl": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "UseBase64": { + "type": "boolean" + } + }, + "required": [ + "QueueUrl", + "RoleArn" + ], + "type": "object" + }, + "AWS::IoT::TopicRule.TopicRulePayload": { + "properties": { + "Actions": { + "items": { + "$ref": "#/definitions/AWS::IoT::TopicRule.Action" + }, + "type": "array" + }, + "AwsIotSqlVersion": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "RuleDisabled": { + "type": "boolean" + }, + "Sql": { + "type": "string" + } + }, + "required": [ + "Actions", + "RuleDisabled", + "Sql" + ], + "type": "object" + }, + "AWS::KMS::Alias": { + "properties": { + "AliasName": { + "type": "string" + }, + "TargetKeyId": { + "type": "string" + } + }, + "required": [ + "AliasName", + "TargetKeyId" + ], + "type": "object" + }, + "AWS::KMS::Key": { + "properties": { + "Description": { + "type": "string" + }, + "EnableKeyRotation": { + "type": "boolean" + }, + "Enabled": { + "type": "boolean" + }, + "KeyPolicy": { + "type": "object" + }, + "KeyUsage": { + "type": "string" + } + }, + "required": [ + "KeyPolicy" + ], + "type": "object" + }, + "AWS::Kinesis::Stream": { + "properties": { + "Name": { + "type": "string" + }, + "RetentionPeriodHours": { + "type": "number" + }, + "ShardCount": { + "type": "number" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "ShardCount" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application": { + "properties": { + "ApplicationCode": { + "type": "string" + }, + "ApplicationDescription": { + "type": "string" + }, + "ApplicationName": { + "type": "string" + }, + "Inputs": { + "items": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.Input" + }, + "type": "array" + } + }, + "required": [ + "Inputs" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application.CSVMappingParameters": { + "properties": { + "RecordColumnDelimiter": { + "type": "string" + }, + "RecordRowDelimiter": { + "type": "string" + } + }, + "required": [ + "RecordColumnDelimiter", + "RecordRowDelimiter" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application.Input": { + "properties": { + "InputParallelism": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.InputParallelism" + }, + "InputSchema": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.InputSchema" + }, + "KinesisFirehoseInput": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.KinesisFirehoseInput" + }, + "KinesisStreamsInput": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.KinesisStreamsInput" + }, + "NamePrefix": { + "type": "string" + } + }, + "required": [ + "InputSchema", + "NamePrefix" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application.InputParallelism": { + "properties": { + "Count": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::KinesisAnalytics::Application.InputSchema": { + "properties": { + "RecordColumns": { + "items": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.RecordColumn" + }, + "type": "array" + }, + "RecordEncoding": { + "type": "string" + }, + "RecordFormat": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.RecordFormat" + } + }, + "required": [ + "RecordColumns", + "RecordFormat" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application.JSONMappingParameters": { + "properties": { + "RecordRowPath": { + "type": "string" + } + }, + "required": [ + "RecordRowPath" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application.KinesisFirehoseInput": { + "properties": { + "ResourceARN": { + "type": "string" + }, + "RoleARN": { + "type": "string" + } + }, + "required": [ + "ResourceARN", + "RoleARN" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application.KinesisStreamsInput": { + "properties": { + "ResourceARN": { + "type": "string" + }, + "RoleARN": { + "type": "string" + } + }, + "required": [ + "ResourceARN", + "RoleARN" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application.MappingParameters": { + "properties": { + "CSVMappingParameters": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.CSVMappingParameters" + }, + "JSONMappingParameters": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.JSONMappingParameters" + } + }, + "type": "object" + }, + "AWS::KinesisAnalytics::Application.RecordColumn": { + "properties": { + "Mapping": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "SqlType": { + "type": "string" + } + }, + "required": [ + "Name", + "SqlType" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::Application.RecordFormat": { + "properties": { + "MappingParameters": { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application.MappingParameters" + }, + "RecordFormatType": { + "type": "string" + } + }, + "required": [ + "RecordFormatType" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationOutput": { + "properties": { + "ApplicationName": { + "type": "string" + }, + "Output": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationOutput.Output" + } + }, + "required": [ + "ApplicationName", + "Output" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationOutput.DestinationSchema": { + "properties": { + "RecordFormatType": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationOutput.KinesisFirehoseOutput": { + "properties": { + "ResourceARN": { + "type": "string" + }, + "RoleARN": { + "type": "string" + } + }, + "required": [ + "ResourceARN", + "RoleARN" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationOutput.KinesisStreamsOutput": { + "properties": { + "ResourceARN": { + "type": "string" + }, + "RoleARN": { + "type": "string" + } + }, + "required": [ + "ResourceARN", + "RoleARN" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationOutput.Output": { + "properties": { + "DestinationSchema": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationOutput.DestinationSchema" + }, + "KinesisFirehoseOutput": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationOutput.KinesisFirehoseOutput" + }, + "KinesisStreamsOutput": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationOutput.KinesisStreamsOutput" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "DestinationSchema" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource": { + "properties": { + "ApplicationName": { + "type": "string" + }, + "ReferenceDataSource": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceDataSource" + } + }, + "required": [ + "ApplicationName", + "ReferenceDataSource" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource.CSVMappingParameters": { + "properties": { + "RecordColumnDelimiter": { + "type": "string" + }, + "RecordRowDelimiter": { + "type": "string" + } + }, + "required": [ + "RecordColumnDelimiter", + "RecordRowDelimiter" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource.JSONMappingParameters": { + "properties": { + "RecordRowPath": { + "type": "string" + } + }, + "required": [ + "RecordRowPath" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource.MappingParameters": { + "properties": { + "CSVMappingParameters": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource.CSVMappingParameters" + }, + "JSONMappingParameters": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource.JSONMappingParameters" + } + }, + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordColumn": { + "properties": { + "Mapping": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "SqlType": { + "type": "string" + } + }, + "required": [ + "Name", + "SqlType" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordFormat": { + "properties": { + "MappingParameters": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource.MappingParameters" + }, + "RecordFormatType": { + "type": "string" + } + }, + "required": [ + "RecordFormatType" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceDataSource": { + "properties": { + "ReferenceSchema": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceSchema" + }, + "S3ReferenceDataSource": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource.S3ReferenceDataSource" + }, + "TableName": { + "type": "string" + } + }, + "required": [ + "ReferenceSchema" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceSchema": { + "properties": { + "RecordColumns": { + "items": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordColumn" + }, + "type": "array" + }, + "RecordEncoding": { + "type": "string" + }, + "RecordFormat": { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordFormat" + } + }, + "required": [ + "RecordColumns", + "RecordFormat" + ], + "type": "object" + }, + "AWS::KinesisAnalytics::ApplicationReferenceDataSource.S3ReferenceDataSource": { + "properties": { + "BucketARN": { + "type": "string" + }, + "FileKey": { + "type": "string" + }, + "ReferenceRoleARN": { + "type": "string" + } + }, + "required": [ + "BucketARN", + "FileKey", + "ReferenceRoleARN" + ], + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream": { + "properties": { + "DeliveryStreamName": { + "type": "string" + }, + "ElasticsearchDestinationConfiguration": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.ElasticsearchDestinationConfiguration" + }, + "RedshiftDestinationConfiguration": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.RedshiftDestinationConfiguration" + }, + "S3DestinationConfiguration": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.S3DestinationConfiguration" + } + }, + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.BufferingHints": { + "properties": { + "IntervalInSeconds": { + "type": "number" + }, + "SizeInMBs": { + "type": "number" + } + }, + "required": [ + "IntervalInSeconds", + "SizeInMBs" + ], + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.CloudWatchLoggingOptions": { + "properties": { + "Enabled": { + "type": "boolean" + }, + "LogGroupName": { + "type": "string" + }, + "LogStreamName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.CopyCommand": { + "properties": { + "CopyOptions": { + "type": "string" + }, + "DataTableColumns": { + "type": "string" + }, + "DataTableName": { + "type": "string" + } + }, + "required": [ + "DataTableName" + ], + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.ElasticsearchBufferingHints": { + "properties": { + "IntervalInSeconds": { + "type": "number" + }, + "SizeInMBs": { + "type": "number" + } + }, + "required": [ + "IntervalInSeconds", + "SizeInMBs" + ], + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.ElasticsearchDestinationConfiguration": { + "properties": { + "BufferingHints": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.ElasticsearchBufferingHints" + }, + "CloudWatchLoggingOptions": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.CloudWatchLoggingOptions" + }, + "DomainARN": { + "type": "string" + }, + "IndexName": { + "type": "string" + }, + "IndexRotationPeriod": { + "type": "string" + }, + "RetryOptions": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.ElasticsearchRetryOptions" + }, + "RoleARN": { + "type": "string" + }, + "S3BackupMode": { + "type": "string" + }, + "S3Configuration": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.S3DestinationConfiguration" + }, + "TypeName": { + "type": "string" + } + }, + "required": [ + "BufferingHints", + "DomainARN", + "IndexName", + "IndexRotationPeriod", + "RetryOptions", + "RoleARN", + "S3BackupMode", + "S3Configuration", + "TypeName" + ], + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.ElasticsearchRetryOptions": { + "properties": { + "DurationInSeconds": { + "type": "number" + } + }, + "required": [ + "DurationInSeconds" + ], + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.EncryptionConfiguration": { + "properties": { + "KMSEncryptionConfig": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.KMSEncryptionConfig" + }, + "NoEncryptionConfig": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.KMSEncryptionConfig": { + "properties": { + "AWSKMSKeyARN": { + "type": "string" + } + }, + "required": [ + "AWSKMSKeyARN" + ], + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.RedshiftDestinationConfiguration": { + "properties": { + "CloudWatchLoggingOptions": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.CloudWatchLoggingOptions" + }, + "ClusterJDBCURL": { + "type": "string" + }, + "CopyCommand": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.CopyCommand" + }, + "Password": { + "type": "string" + }, + "RoleARN": { + "type": "string" + }, + "S3Configuration": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.S3DestinationConfiguration" + }, + "Username": { + "type": "string" + } + }, + "required": [ + "ClusterJDBCURL", + "CopyCommand", + "Password", + "RoleARN", + "S3Configuration", + "Username" + ], + "type": "object" + }, + "AWS::KinesisFirehose::DeliveryStream.S3DestinationConfiguration": { + "properties": { + "BucketARN": { + "type": "string" + }, + "BufferingHints": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.BufferingHints" + }, + "CloudWatchLoggingOptions": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.CloudWatchLoggingOptions" + }, + "CompressionFormat": { + "type": "string" + }, + "EncryptionConfiguration": { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream.EncryptionConfiguration" + }, + "Prefix": { + "type": "string" + }, + "RoleARN": { + "type": "string" + } + }, + "required": [ + "BucketARN", + "BufferingHints", + "CompressionFormat", + "Prefix", + "RoleARN" + ], + "type": "object" + }, + "AWS::Lambda::Alias": { + "properties": { + "Description": { + "type": "string" + }, + "FunctionName": { + "type": "string" + }, + "FunctionVersion": { + "type": "string" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "FunctionName", + "FunctionVersion", + "Name" + ], + "type": "object" + }, + "AWS::Lambda::EventSourceMapping": { + "properties": { + "BatchSize": { + "type": "number" + }, + "Enabled": { + "type": "boolean" + }, + "EventSourceArn": { + "type": "string" + }, + "FunctionName": { + "type": "string" + }, + "StartingPosition": { + "type": "string" + } + }, + "required": [ + "EventSourceArn", + "FunctionName", + "StartingPosition" + ], + "type": "object" + }, + "AWS::Lambda::Function": { + "properties": { + "Code": { + "$ref": "#/definitions/AWS::Lambda::Function.Code" + }, + "DeadLetterConfig": { + "$ref": "#/definitions/AWS::Lambda::Function.DeadLetterConfig" + }, + "Description": { + "type": "string" + }, + "Environment": { + "$ref": "#/definitions/AWS::Lambda::Function.Environment" + }, + "FunctionName": { + "type": "string" + }, + "Handler": { + "type": "string" + }, + "KmsKeyArn": { + "type": "string" + }, + "MemorySize": { + "type": "number" + }, + "Role": { + "type": "string" + }, + "Runtime": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "Timeout": { + "type": "number" + }, + "TracingConfig": { + "$ref": "#/definitions/AWS::Lambda::Function.TracingConfig" + }, + "VpcConfig": { + "$ref": "#/definitions/AWS::Lambda::Function.VpcConfig" + } + }, + "required": [ + "Code", + "Handler", + "Role", + "Runtime" + ], + "type": "object" + }, + "AWS::Lambda::Function.Code": { + "properties": { + "S3Bucket": { + "type": "string" + }, + "S3Key": { + "type": "string" + }, + "S3ObjectVersion": { + "type": "string" + }, + "ZipFile": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Lambda::Function.DeadLetterConfig": { + "properties": { + "TargetArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Lambda::Function.Environment": { + "properties": { + "Variables": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "AWS::Lambda::Function.TracingConfig": { + "properties": { + "Mode": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Lambda::Function.VpcConfig": { + "properties": { + "SecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SubnetIds": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "SecurityGroupIds", + "SubnetIds" + ], + "type": "object" + }, + "AWS::Lambda::Permission": { + "properties": { + "Action": { + "type": "string" + }, + "FunctionName": { + "type": "string" + }, + "Principal": { + "type": "string" + }, + "SourceAccount": { + "type": "string" + }, + "SourceArn": { + "type": "string" + } + }, + "required": [ + "Action", + "FunctionName", + "Principal" + ], + "type": "object" + }, + "AWS::Lambda::Version": { + "properties": { + "CodeSha256": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "FunctionName": { + "type": "string" + } + }, + "required": [ + "FunctionName" + ], + "type": "object" + }, + "AWS::Logs::Destination": { + "properties": { + "DestinationName": { + "type": "string" + }, + "DestinationPolicy": { + "type": "string" + }, + "RoleArn": { + "type": "string" + }, + "TargetArn": { + "type": "string" + } + }, + "required": [ + "DestinationName", + "DestinationPolicy", + "RoleArn", + "TargetArn" + ], + "type": "object" + }, + "AWS::Logs::LogGroup": { + "properties": { + "LogGroupName": { + "type": "string" + }, + "RetentionInDays": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::Logs::LogStream": { + "properties": { + "LogGroupName": { + "type": "string" + }, + "LogStreamName": { + "type": "string" + } + }, + "required": [ + "LogGroupName" + ], + "type": "object" + }, + "AWS::Logs::MetricFilter": { + "properties": { + "FilterPattern": { + "type": "string" + }, + "LogGroupName": { + "type": "string" + }, + "MetricTransformations": { + "items": { + "$ref": "#/definitions/AWS::Logs::MetricFilter.MetricTransformation" + }, + "type": "array" + } + }, + "required": [ + "FilterPattern", + "LogGroupName", + "MetricTransformations" + ], + "type": "object" + }, + "AWS::Logs::MetricFilter.MetricTransformation": { + "properties": { + "MetricName": { + "type": "string" + }, + "MetricNamespace": { + "type": "string" + }, + "MetricValue": { + "type": "string" + } + }, + "required": [ + "MetricName", + "MetricNamespace", + "MetricValue" + ], + "type": "object" + }, + "AWS::Logs::SubscriptionFilter": { + "properties": { + "DestinationArn": { + "type": "string" + }, + "FilterPattern": { + "type": "string" + }, + "LogGroupName": { + "type": "string" + }, + "RoleArn": { + "type": "string" + } + }, + "required": [ + "DestinationArn", + "FilterPattern", + "LogGroupName" + ], + "type": "object" + }, + "AWS::OpsWorks::App": { + "properties": { + "AppSource": { + "$ref": "#/definitions/AWS::OpsWorks::App.Source" + }, + "Attributes": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "DataSources": { + "items": { + "$ref": "#/definitions/AWS::OpsWorks::App.DataSource" + }, + "type": "array" + }, + "Description": { + "type": "string" + }, + "Domains": { + "items": { + "type": "string" + }, + "type": "array" + }, + "EnableSsl": { + "type": "boolean" + }, + "Environment": { + "items": { + "$ref": "#/definitions/AWS::OpsWorks::App.EnvironmentVariable" + }, + "type": "array" + }, + "Name": { + "type": "string" + }, + "Shortname": { + "type": "string" + }, + "SslConfiguration": { + "$ref": "#/definitions/AWS::OpsWorks::App.SslConfiguration" + }, + "StackId": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Name", + "StackId", + "Type" + ], + "type": "object" + }, + "AWS::OpsWorks::App.DataSource": { + "properties": { + "Arn": { + "type": "string" + }, + "DatabaseName": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::OpsWorks::App.EnvironmentVariable": { + "properties": { + "Key": { + "type": "string" + }, + "Secure": { + "type": "boolean" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + }, + "AWS::OpsWorks::App.Source": { + "properties": { + "Password": { + "type": "string" + }, + "Revision": { + "type": "string" + }, + "SshKey": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Url": { + "type": "string" + }, + "Username": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::OpsWorks::App.SslConfiguration": { + "properties": { + "Certificate": { + "type": "string" + }, + "Chain": { + "type": "string" + }, + "PrivateKey": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::OpsWorks::ElasticLoadBalancerAttachment": { + "properties": { + "ElasticLoadBalancerName": { + "type": "string" + }, + "LayerId": { + "type": "string" + } + }, + "required": [ + "ElasticLoadBalancerName", + "LayerId" + ], + "type": "object" + }, + "AWS::OpsWorks::Instance": { + "properties": { + "AgentVersion": { + "type": "string" + }, + "AmiId": { + "type": "string" + }, + "Architecture": { + "type": "string" + }, + "AutoScalingType": { + "type": "string" + }, + "AvailabilityZone": { + "type": "string" + }, + "BlockDeviceMappings": { + "items": { + "$ref": "#/definitions/AWS::OpsWorks::Instance.BlockDeviceMapping" + }, + "type": "array" + }, + "EbsOptimized": { + "type": "boolean" + }, + "ElasticIps": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Hostname": { + "type": "string" + }, + "InstallUpdatesOnBoot": { + "type": "boolean" + }, + "InstanceType": { + "type": "string" + }, + "LayerIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Os": { + "type": "string" + }, + "RootDeviceType": { + "type": "string" + }, + "SshKeyName": { + "type": "string" + }, + "StackId": { + "type": "string" + }, + "SubnetId": { + "type": "string" + }, + "Tenancy": { + "type": "string" + }, + "TimeBasedAutoScaling": { + "$ref": "#/definitions/AWS::OpsWorks::Instance.TimeBasedAutoScaling" + }, + "VirtualizationType": { + "type": "string" + }, + "Volumes": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "InstanceType", + "LayerIds", + "StackId" + ], + "type": "object" + }, + "AWS::OpsWorks::Instance.BlockDeviceMapping": { + "properties": { + "DeviceName": { + "type": "string" + }, + "Ebs": { + "$ref": "#/definitions/AWS::OpsWorks::Instance.EbsBlockDevice" + }, + "NoDevice": { + "type": "string" + }, + "VirtualName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Instance.EbsBlockDevice": { + "properties": { + "DeleteOnTermination": { + "type": "boolean" + }, + "Iops": { + "type": "number" + }, + "SnapshotId": { + "type": "string" + }, + "VolumeSize": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Instance.TimeBasedAutoScaling": { + "properties": { + "Friday": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Monday": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Saturday": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Sunday": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Thursday": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Tuesday": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Wednesday": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Layer": { + "properties": { + "Attributes": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "AutoAssignElasticIps": { + "type": "boolean" + }, + "AutoAssignPublicIps": { + "type": "boolean" + }, + "CustomInstanceProfileArn": { + "type": "string" + }, + "CustomJson": { + "type": "object" + }, + "CustomRecipes": { + "$ref": "#/definitions/AWS::OpsWorks::Layer.Recipes" + }, + "CustomSecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "EnableAutoHealing": { + "type": "boolean" + }, + "InstallUpdatesOnBoot": { + "type": "boolean" + }, + "LifecycleEventConfiguration": { + "$ref": "#/definitions/AWS::OpsWorks::Layer.LifecycleEventConfiguration" + }, + "LoadBasedAutoScaling": { + "$ref": "#/definitions/AWS::OpsWorks::Layer.LoadBasedAutoScaling" + }, + "Name": { + "type": "string" + }, + "Packages": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Shortname": { + "type": "string" + }, + "StackId": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "UseEbsOptimizedInstances": { + "type": "boolean" + }, + "VolumeConfigurations": { + "items": { + "$ref": "#/definitions/AWS::OpsWorks::Layer.VolumeConfiguration" + }, + "type": "array" + } + }, + "required": [ + "AutoAssignElasticIps", + "AutoAssignPublicIps", + "EnableAutoHealing", + "Name", + "Shortname", + "StackId", + "Type" + ], + "type": "object" + }, + "AWS::OpsWorks::Layer.AutoScalingThresholds": { + "properties": { + "CpuThreshold": { + "type": "number" + }, + "IgnoreMetricsTime": { + "type": "number" + }, + "InstanceCount": { + "type": "number" + }, + "LoadThreshold": { + "type": "number" + }, + "MemoryThreshold": { + "type": "number" + }, + "ThresholdsWaitTime": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Layer.LifecycleEventConfiguration": { + "properties": { + "ShutdownEventConfiguration": { + "$ref": "#/definitions/AWS::OpsWorks::Layer.ShutdownEventConfiguration" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Layer.LoadBasedAutoScaling": { + "properties": { + "DownScaling": { + "$ref": "#/definitions/AWS::OpsWorks::Layer.AutoScalingThresholds" + }, + "Enable": { + "type": "boolean" + }, + "UpScaling": { + "$ref": "#/definitions/AWS::OpsWorks::Layer.AutoScalingThresholds" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Layer.Recipes": { + "properties": { + "Configure": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Deploy": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Setup": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Shutdown": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Undeploy": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Layer.ShutdownEventConfiguration": { + "properties": { + "DelayUntilElbConnectionsDrained": { + "type": "boolean" + }, + "ExecutionTimeout": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Layer.VolumeConfiguration": { + "properties": { + "Iops": { + "type": "number" + }, + "MountPoint": { + "type": "string" + }, + "NumberOfDisks": { + "type": "number" + }, + "RaidLevel": { + "type": "number" + }, + "Size": { + "type": "number" + }, + "VolumeType": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Stack": { + "properties": { + "AgentVersion": { + "type": "string" + }, + "Attributes": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "ChefConfiguration": { + "$ref": "#/definitions/AWS::OpsWorks::Stack.ChefConfiguration" + }, + "CloneAppIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ClonePermissions": { + "type": "boolean" + }, + "ConfigurationManager": { + "$ref": "#/definitions/AWS::OpsWorks::Stack.StackConfigurationManager" + }, + "CustomCookbooksSource": { + "$ref": "#/definitions/AWS::OpsWorks::Stack.Source" + }, + "CustomJson": { + "type": "object" + }, + "DefaultAvailabilityZone": { + "type": "string" + }, + "DefaultInstanceProfileArn": { + "type": "string" + }, + "DefaultOs": { + "type": "string" + }, + "DefaultRootDeviceType": { + "type": "string" + }, + "DefaultSshKeyName": { + "type": "string" + }, + "DefaultSubnetId": { + "type": "string" + }, + "EcsClusterArn": { + "type": "string" + }, + "ElasticIps": { + "items": { + "$ref": "#/definitions/AWS::OpsWorks::Stack.ElasticIp" + }, + "type": "array" + }, + "HostnameTheme": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "RdsDbInstances": { + "items": { + "$ref": "#/definitions/AWS::OpsWorks::Stack.RdsDbInstance" + }, + "type": "array" + }, + "ServiceRoleArn": { + "type": "string" + }, + "SourceStackId": { + "type": "string" + }, + "UseCustomCookbooks": { + "type": "boolean" + }, + "UseOpsworksSecurityGroups": { + "type": "boolean" + }, + "VpcId": { + "type": "string" + } + }, + "required": [ + "DefaultInstanceProfileArn", + "Name", + "ServiceRoleArn" + ], + "type": "object" + }, + "AWS::OpsWorks::Stack.ChefConfiguration": { + "properties": { + "BerkshelfVersion": { + "type": "string" + }, + "ManageBerkshelf": { + "type": "boolean" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Stack.ElasticIp": { + "properties": { + "Ip": { + "type": "string" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "Ip" + ], + "type": "object" + }, + "AWS::OpsWorks::Stack.RdsDbInstance": { + "properties": { + "DbPassword": { + "type": "string" + }, + "DbUser": { + "type": "string" + }, + "RdsDbInstanceArn": { + "type": "string" + } + }, + "required": [ + "DbPassword", + "DbUser", + "RdsDbInstanceArn" + ], + "type": "object" + }, + "AWS::OpsWorks::Stack.Source": { + "properties": { + "Password": { + "type": "string" + }, + "Revision": { + "type": "string" + }, + "SshKey": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Url": { + "type": "string" + }, + "Username": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::OpsWorks::Stack.StackConfigurationManager": { + "properties": { + "Name": { + "type": "string" + }, + "Version": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::OpsWorks::UserProfile": { + "properties": { + "AllowSelfManagement": { + "type": "boolean" + }, + "IamUserArn": { + "type": "string" + }, + "SshPublicKey": { + "type": "string" + }, + "SshUsername": { + "type": "string" + } + }, + "required": [ + "IamUserArn" + ], + "type": "object" + }, + "AWS::OpsWorks::Volume": { + "properties": { + "Ec2VolumeId": { + "type": "string" + }, + "MountPoint": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "StackId": { + "type": "string" + } + }, + "required": [ + "Ec2VolumeId", + "StackId" + ], + "type": "object" + }, + "AWS::RDS::DBCluster": { + "properties": { + "AvailabilityZones": { + "type": "string" + }, + "BackupRetentionPeriod": { + "type": "number" + }, + "DBClusterParameterGroupName": { + "type": "string" + }, + "DBSubnetGroupName": { + "type": "string" + }, + "DatabaseName": { + "type": "string" + }, + "Engine": { + "type": "string" + }, + "EngineVersion": { + "type": "string" + }, + "KmsKeyId": { + "type": "string" + }, + "MasterUserPassword": { + "type": "string" + }, + "MasterUsername": { + "type": "string" + }, + "Port": { + "type": "number" + }, + "PreferredBackupWindow": { + "type": "string" + }, + "PreferredMaintenanceWindow": { + "type": "string" + }, + "ReplicationSourceIdentifier": { + "type": "string" + }, + "SnapshotIdentifier": { + "type": "string" + }, + "StorageEncrypted": { + "type": "boolean" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcSecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "Engine" + ], + "type": "object" + }, + "AWS::RDS::DBClusterParameterGroup": { + "properties": { + "Description": { + "type": "string" + }, + "Family": { + "type": "string" + }, + "Parameters": { + "type": "object" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "Description", + "Family", + "Parameters" + ], + "type": "object" + }, + "AWS::RDS::DBInstance": { + "properties": { + "AllocatedStorage": { + "type": "string" + }, + "AllowMajorVersionUpgrade": { + "type": "boolean" + }, + "AutoMinorVersionUpgrade": { + "type": "boolean" + }, + "AvailabilityZone": { + "type": "string" + }, + "BackupRetentionPeriod": { + "type": "string" + }, + "CharacterSetName": { + "type": "string" + }, + "CopyTagsToSnapshot": { + "type": "boolean" + }, + "DBClusterIdentifier": { + "type": "string" + }, + "DBInstanceClass": { + "type": "string" + }, + "DBInstanceIdentifier": { + "type": "string" + }, + "DBName": { + "type": "string" + }, + "DBParameterGroupName": { + "type": "string" + }, + "DBSecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "DBSnapshotIdentifier": { + "type": "string" + }, + "DBSubnetGroupName": { + "type": "string" + }, + "Domain": { + "type": "string" + }, + "DomainIAMRoleName": { + "type": "string" + }, + "Engine": { + "type": "string" + }, + "EngineVersion": { + "type": "string" + }, + "Iops": { + "type": "number" + }, + "KmsKeyId": { + "type": "string" + }, + "LicenseModel": { + "type": "string" + }, + "MasterUserPassword": { + "type": "string" + }, + "MasterUsername": { + "type": "string" + }, + "MonitoringInterval": { + "type": "number" + }, + "MonitoringRoleArn": { + "type": "string" + }, + "MultiAZ": { + "type": "boolean" + }, + "OptionGroupName": { + "type": "string" + }, + "Port": { + "type": "string" + }, + "PreferredBackupWindow": { + "type": "string" + }, + "PreferredMaintenanceWindow": { + "type": "string" + }, + "PubliclyAccessible": { + "type": "boolean" + }, + "SourceDBInstanceIdentifier": { + "type": "string" + }, + "StorageEncrypted": { + "type": "boolean" + }, + "StorageType": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "Timezone": { + "type": "string" + }, + "VPCSecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "DBInstanceClass" + ], + "type": "object" + }, + "AWS::RDS::DBParameterGroup": { + "properties": { + "Description": { + "type": "string" + }, + "Family": { + "type": "string" + }, + "Parameters": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "type": "string" + } + }, + "type": "object" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "Description", + "Family" + ], + "type": "object" + }, + "AWS::RDS::DBSecurityGroup": { + "properties": { + "DBSecurityGroupIngress": { + "items": { + "$ref": "#/definitions/AWS::RDS::DBSecurityGroup.Ingress" + }, + "type": "array" + }, + "EC2VpcId": { + "type": "string" + }, + "GroupDescription": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "DBSecurityGroupIngress", + "GroupDescription" + ], + "type": "object" + }, + "AWS::RDS::DBSecurityGroup.Ingress": { + "properties": { + "CIDRIP": { + "type": "string" + }, + "EC2SecurityGroupId": { + "type": "string" + }, + "EC2SecurityGroupName": { + "type": "string" + }, + "EC2SecurityGroupOwnerId": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::RDS::DBSecurityGroupIngress": { + "properties": { + "CIDRIP": { + "type": "string" + }, + "DBSecurityGroupName": { + "type": "string" + }, + "EC2SecurityGroupId": { + "type": "string" + }, + "EC2SecurityGroupName": { + "type": "string" + }, + "EC2SecurityGroupOwnerId": { + "type": "string" + } + }, + "required": [ + "DBSecurityGroupName" + ], + "type": "object" + }, + "AWS::RDS::DBSubnetGroup": { + "properties": { + "DBSubnetGroupDescription": { + "type": "string" + }, + "SubnetIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "DBSubnetGroupDescription", + "SubnetIds" + ], + "type": "object" + }, + "AWS::RDS::EventSubscription": { + "properties": { + "Enabled": { + "type": "boolean" + }, + "EventCategories": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SnsTopicArn": { + "type": "string" + }, + "SourceIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SourceType": { + "type": "string" + } + }, + "required": [ + "SnsTopicArn" + ], + "type": "object" + }, + "AWS::RDS::OptionGroup": { + "properties": { + "EngineName": { + "type": "string" + }, + "MajorEngineVersion": { + "type": "string" + }, + "OptionConfigurations": { + "items": { + "$ref": "#/definitions/AWS::RDS::OptionGroup.OptionConfiguration" + }, + "type": "array" + }, + "OptionGroupDescription": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "EngineName", + "MajorEngineVersion", + "OptionConfigurations", + "OptionGroupDescription" + ], + "type": "object" + }, + "AWS::RDS::OptionGroup.OptionConfiguration": { + "properties": { + "DBSecurityGroupMemberships": { + "items": { + "type": "string" + }, + "type": "array" + }, + "OptionName": { + "type": "string" + }, + "OptionSettings": { + "$ref": "#/definitions/AWS::RDS::OptionGroup.OptionSetting" + }, + "Port": { + "type": "number" + }, + "VpcSecurityGroupMemberships": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "OptionName" + ], + "type": "object" + }, + "AWS::RDS::OptionGroup.OptionSetting": { + "properties": { + "Name": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Redshift::Cluster": { + "properties": { + "AllowVersionUpgrade": { + "type": "boolean" + }, + "AutomatedSnapshotRetentionPeriod": { + "type": "number" + }, + "AvailabilityZone": { + "type": "string" + }, + "ClusterParameterGroupName": { + "type": "string" + }, + "ClusterSecurityGroups": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ClusterSubnetGroupName": { + "type": "string" + }, + "ClusterType": { + "type": "string" + }, + "ClusterVersion": { + "type": "string" + }, + "DBName": { + "type": "string" + }, + "ElasticIp": { + "type": "string" + }, + "Encrypted": { + "type": "boolean" + }, + "HsmClientCertificateIdentifier": { + "type": "string" + }, + "HsmConfigurationIdentifier": { + "type": "string" + }, + "IamRoles": { + "items": { + "type": "string" + }, + "type": "array" + }, + "KmsKeyId": { + "type": "string" + }, + "LoggingProperties": { + "$ref": "#/definitions/AWS::Redshift::Cluster.LoggingProperties" + }, + "MasterUserPassword": { + "type": "string" + }, + "MasterUsername": { + "type": "string" + }, + "NodeType": { + "type": "string" + }, + "NumberOfNodes": { + "type": "number" + }, + "OwnerAccount": { + "type": "string" + }, + "Port": { + "type": "number" + }, + "PreferredMaintenanceWindow": { + "type": "string" + }, + "PubliclyAccessible": { + "type": "boolean" + }, + "SnapshotClusterIdentifier": { + "type": "string" + }, + "SnapshotIdentifier": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VpcSecurityGroupIds": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "ClusterType", + "DBName", + "MasterUserPassword", + "MasterUsername", + "NodeType" + ], + "type": "object" + }, + "AWS::Redshift::Cluster.LoggingProperties": { + "properties": { + "BucketName": { + "type": "string" + }, + "S3KeyPrefix": { + "type": "string" + } + }, + "required": [ + "BucketName" + ], + "type": "object" + }, + "AWS::Redshift::ClusterParameterGroup": { + "properties": { + "Description": { + "type": "string" + }, + "ParameterGroupFamily": { + "type": "string" + }, + "Parameters": { + "items": { + "$ref": "#/definitions/AWS::Redshift::ClusterParameterGroup.Parameter" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "Description", + "ParameterGroupFamily" + ], + "type": "object" + }, + "AWS::Redshift::ClusterParameterGroup.Parameter": { + "properties": { + "ParameterName": { + "type": "string" + }, + "ParameterValue": { + "type": "string" + } + }, + "required": [ + "ParameterName", + "ParameterValue" + ], + "type": "object" + }, + "AWS::Redshift::ClusterSecurityGroup": { + "properties": { + "Description": { + "type": "string" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "Description" + ], + "type": "object" + }, + "AWS::Redshift::ClusterSecurityGroupIngress": { + "properties": { + "CIDRIP": { + "type": "string" + }, + "ClusterSecurityGroupName": { + "type": "string" + }, + "EC2SecurityGroupName": { + "type": "string" + }, + "EC2SecurityGroupOwnerId": { + "type": "string" + } + }, + "required": [ + "ClusterSecurityGroupName" + ], + "type": "object" + }, + "AWS::Redshift::ClusterSubnetGroup": { + "properties": { + "Description": { + "type": "string" + }, + "SubnetIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + } + }, + "required": [ + "Description", + "SubnetIds" + ], + "type": "object" + }, + "AWS::Route53::HealthCheck": { + "properties": { + "HealthCheckConfig": { + "$ref": "#/definitions/AWS::Route53::HealthCheck.HealthCheckConfig" + }, + "HealthCheckTags": { + "items": { + "$ref": "#/definitions/AWS::Route53::HealthCheck.HealthCheckTag" + }, + "type": "array" + } + }, + "required": [ + "HealthCheckConfig" + ], + "type": "object" + }, + "AWS::Route53::HealthCheck.AlarmIdentifier": { + "properties": { + "Name": { + "type": "string" + }, + "Region": { + "type": "string" + } + }, + "required": [ + "Name", + "Region" + ], + "type": "object" + }, + "AWS::Route53::HealthCheck.HealthCheckConfig": { + "properties": { + "AlarmIdentifier": { + "$ref": "#/definitions/AWS::Route53::HealthCheck.AlarmIdentifier" + }, + "ChildHealthChecks": { + "items": { + "type": "string" + }, + "type": "array" + }, + "EnableSNI": { + "type": "boolean" + }, + "FailureThreshold": { + "type": "number" + }, + "FullyQualifiedDomainName": { + "type": "string" + }, + "HealthThreshold": { + "type": "number" + }, + "IPAddress": { + "type": "string" + }, + "InsufficientDataHealthStatus": { + "type": "string" + }, + "Inverted": { + "type": "boolean" + }, + "MeasureLatency": { + "type": "boolean" + }, + "Port": { + "type": "number" + }, + "RequestInterval": { + "type": "number" + }, + "ResourcePath": { + "type": "string" + }, + "SearchString": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::Route53::HealthCheck.HealthCheckTag": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + }, + "AWS::Route53::HostedZone": { + "properties": { + "HostedZoneConfig": { + "$ref": "#/definitions/AWS::Route53::HostedZone.HostedZoneConfig" + }, + "HostedZoneTags": { + "items": { + "$ref": "#/definitions/AWS::Route53::HostedZone.HostedZoneTag" + }, + "type": "array" + }, + "Name": { + "type": "string" + }, + "VPCs": { + "items": { + "$ref": "#/definitions/AWS::Route53::HostedZone.VPC" + }, + "type": "array" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::Route53::HostedZone.HostedZoneConfig": { + "properties": { + "Comment": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Route53::HostedZone.HostedZoneTag": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + }, + "AWS::Route53::HostedZone.VPC": { + "properties": { + "VPCId": { + "type": "string" + }, + "VPCRegion": { + "type": "string" + } + }, + "required": [ + "VPCId", + "VPCRegion" + ], + "type": "object" + }, + "AWS::Route53::RecordSet": { + "properties": { + "AliasTarget": { + "$ref": "#/definitions/AWS::Route53::RecordSet.AliasTarget" + }, + "Comment": { + "type": "string" + }, + "Failover": { + "type": "string" + }, + "GeoLocation": { + "$ref": "#/definitions/AWS::Route53::RecordSet.GeoLocation" + }, + "HealthCheckId": { + "type": "string" + }, + "HostedZoneId": { + "type": "string" + }, + "HostedZoneName": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Region": { + "type": "string" + }, + "ResourceRecords": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SetIdentifier": { + "type": "string" + }, + "TTL": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Weight": { + "type": "number" + } + }, + "required": [ + "Name", + "Type" + ], + "type": "object" + }, + "AWS::Route53::RecordSet.AliasTarget": { + "properties": { + "DNSName": { + "type": "string" + }, + "EvaluateTargetHealth": { + "type": "boolean" + }, + "HostedZoneId": { + "type": "string" + } + }, + "required": [ + "DNSName", + "HostedZoneId" + ], + "type": "object" + }, + "AWS::Route53::RecordSet.GeoLocation": { + "properties": { + "ContinentCode": { + "type": "string" + }, + "CountryCode": { + "type": "string" + }, + "SubdivisionCode": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Route53::RecordSetGroup": { + "properties": { + "Comment": { + "type": "string" + }, + "HostedZoneId": { + "type": "string" + }, + "HostedZoneName": { + "type": "string" + }, + "RecordSets": { + "items": { + "$ref": "#/definitions/AWS::Route53::RecordSetGroup.RecordSet" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::Route53::RecordSetGroup.AliasTarget": { + "properties": { + "DNSName": { + "type": "string" + }, + "EvaluateTargetHealth": { + "type": "boolean" + }, + "HostedZoneId": { + "type": "string" + } + }, + "required": [ + "DNSName", + "HostedZoneId" + ], + "type": "object" + }, + "AWS::Route53::RecordSetGroup.GeoLocation": { + "properties": { + "ContinentCode": { + "type": "string" + }, + "CountryCode": { + "type": "string" + }, + "SubdivisionCode": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::Route53::RecordSetGroup.RecordSet": { + "properties": { + "AliasTarget": { + "$ref": "#/definitions/AWS::Route53::RecordSetGroup.AliasTarget" + }, + "Comment": { + "type": "string" + }, + "Failover": { + "type": "string" + }, + "GeoLocation": { + "$ref": "#/definitions/AWS::Route53::RecordSetGroup.GeoLocation" + }, + "HealthCheckId": { + "type": "string" + }, + "HostedZoneId": { + "type": "string" + }, + "HostedZoneName": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Region": { + "type": "string" + }, + "ResourceRecords": { + "items": { + "type": "string" + }, + "type": "array" + }, + "SetIdentifier": { + "type": "string" + }, + "TTL": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Weight": { + "type": "number" + } + }, + "required": [ + "Name", + "Type" + ], + "type": "object" + }, + "AWS::S3::Bucket": { + "properties": { + "AccessControl": { + "type": "string" + }, + "BucketName": { + "type": "string" + }, + "CorsConfiguration": { + "$ref": "#/definitions/AWS::S3::Bucket.CorsConfiguration" + }, + "LifecycleConfiguration": { + "$ref": "#/definitions/AWS::S3::Bucket.LifecycleConfiguration" + }, + "LoggingConfiguration": { + "$ref": "#/definitions/AWS::S3::Bucket.LoggingConfiguration" + }, + "NotificationConfiguration": { + "$ref": "#/definitions/AWS::S3::Bucket.NotificationConfiguration" + }, + "ReplicationConfiguration": { + "$ref": "#/definitions/AWS::S3::Bucket.ReplicationConfiguration" + }, + "Tags": { + "items": { + "$ref": "#/definitions/Tag" + }, + "type": "array" + }, + "VersioningConfiguration": { + "$ref": "#/definitions/AWS::S3::Bucket.VersioningConfiguration" + }, + "WebsiteConfiguration": { + "$ref": "#/definitions/AWS::S3::Bucket.WebsiteConfiguration" + } + }, + "type": "object" + }, + "AWS::S3::Bucket.CorsConfiguration": { + "properties": { + "CorsRules": { + "items": { + "$ref": "#/definitions/AWS::S3::Bucket.CorsRule" + }, + "type": "array" + } + }, + "required": [ + "CorsRules" + ], + "type": "object" + }, + "AWS::S3::Bucket.CorsRule": { + "properties": { + "AllowedHeaders": { + "items": { + "type": "string" + }, + "type": "array" + }, + "AllowedMethods": { + "items": { + "type": "string" + }, + "type": "array" + }, + "AllowedOrigins": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ExposedHeaders": { + "items": { + "type": "string" + }, + "type": "array" + }, + "Id": { + "type": "string" + }, + "MaxAge": { + "type": "number" + } + }, + "required": [ + "AllowedMethods", + "AllowedOrigins" + ], + "type": "object" + }, + "AWS::S3::Bucket.FilterRule": { + "properties": { + "Name": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Name", + "Value" + ], + "type": "object" + }, + "AWS::S3::Bucket.LambdaConfiguration": { + "properties": { + "Event": { + "type": "string" + }, + "Filter": { + "$ref": "#/definitions/AWS::S3::Bucket.NotificationFilter" + }, + "Function": { + "type": "string" + } + }, + "required": [ + "Event", + "Function" + ], + "type": "object" + }, + "AWS::S3::Bucket.LifecycleConfiguration": { + "properties": { + "Rules": { + "items": { + "$ref": "#/definitions/AWS::S3::Bucket.Rule" + }, + "type": "array" + } + }, + "required": [ + "Rules" + ], + "type": "object" + }, + "AWS::S3::Bucket.LoggingConfiguration": { + "properties": { + "DestinationBucketName": { + "type": "string" + }, + "LogFilePrefix": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::S3::Bucket.NoncurrentVersionTransition": { + "properties": { + "StorageClass": { + "type": "string" + }, + "TransitionInDays": { + "type": "number" + } + }, + "required": [ + "StorageClass", + "TransitionInDays" + ], + "type": "object" + }, + "AWS::S3::Bucket.NotificationConfiguration": { + "properties": { + "LambdaConfigurations": { + "items": { + "$ref": "#/definitions/AWS::S3::Bucket.LambdaConfiguration" + }, + "type": "array" + }, + "QueueConfigurations": { + "items": { + "$ref": "#/definitions/AWS::S3::Bucket.QueueConfiguration" + }, + "type": "array" + }, + "TopicConfigurations": { + "items": { + "$ref": "#/definitions/AWS::S3::Bucket.TopicConfiguration" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::S3::Bucket.NotificationFilter": { + "properties": { + "S3Key": { + "$ref": "#/definitions/AWS::S3::Bucket.S3KeyFilter" + } + }, + "required": [ + "S3Key" + ], + "type": "object" + }, + "AWS::S3::Bucket.QueueConfiguration": { + "properties": { + "Event": { + "type": "string" + }, + "Filter": { + "$ref": "#/definitions/AWS::S3::Bucket.NotificationFilter" + }, + "Queue": { + "type": "string" + } + }, + "required": [ + "Event", + "Queue" + ], + "type": "object" + }, + "AWS::S3::Bucket.RedirectAllRequestsTo": { + "properties": { + "HostName": { + "type": "string" + }, + "Protocol": { + "type": "string" + } + }, + "required": [ + "HostName" + ], + "type": "object" + }, + "AWS::S3::Bucket.RedirectRule": { + "properties": { + "HostName": { + "type": "string" + }, + "HttpRedirectCode": { + "type": "string" + }, + "Protocol": { + "type": "string" + }, + "ReplaceKeyPrefixWith": { + "type": "string" + }, + "ReplaceKeyWith": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::S3::Bucket.ReplicationConfiguration": { + "properties": { + "Role": { + "type": "string" + }, + "Rules": { + "items": { + "$ref": "#/definitions/AWS::S3::Bucket.ReplicationRule" + }, + "type": "array" + } + }, + "required": [ + "Role", + "Rules" + ], + "type": "object" + }, + "AWS::S3::Bucket.ReplicationDestination": { + "properties": { + "Bucket": { + "type": "string" + }, + "StorageClass": { + "type": "string" + } + }, + "required": [ + "Bucket" + ], + "type": "object" + }, + "AWS::S3::Bucket.ReplicationRule": { + "properties": { + "Destination": { + "$ref": "#/definitions/AWS::S3::Bucket.ReplicationDestination" + }, + "Id": { + "type": "string" + }, + "Prefix": { + "type": "string" + }, + "Status": { + "type": "string" + } + }, + "required": [ + "Destination", + "Prefix", + "Status" + ], + "type": "object" + }, + "AWS::S3::Bucket.RoutingRule": { + "properties": { + "RedirectRule": { + "$ref": "#/definitions/AWS::S3::Bucket.RedirectRule" + }, + "RoutingRuleCondition": { + "$ref": "#/definitions/AWS::S3::Bucket.RoutingRuleCondition" + } + }, + "required": [ + "RedirectRule" + ], + "type": "object" + }, + "AWS::S3::Bucket.RoutingRuleCondition": { + "properties": { + "HttpErrorCodeReturnedEquals": { + "type": "string" + }, + "KeyPrefixEquals": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::S3::Bucket.Rule": { + "properties": { + "ExpirationDate": { + "type": "string" + }, + "ExpirationInDays": { + "type": "number" + }, + "Id": { + "type": "string" + }, + "NoncurrentVersionExpirationInDays": { + "type": "number" + }, + "NoncurrentVersionTransition": { + "$ref": "#/definitions/AWS::S3::Bucket.NoncurrentVersionTransition" + }, + "NoncurrentVersionTransitions": { + "$ref": "#/definitions/AWS::S3::Bucket.NoncurrentVersionTransition" + }, + "Prefix": { + "type": "string" + }, + "Status": { + "type": "string" + }, + "Transition": { + "$ref": "#/definitions/AWS::S3::Bucket.Transition" + }, + "Transitions": { + "$ref": "#/definitions/AWS::S3::Bucket.Transition" + } + }, + "required": [ + "Status" + ], + "type": "object" + }, + "AWS::S3::Bucket.S3KeyFilter": { + "properties": { + "Rules": { + "items": { + "$ref": "#/definitions/AWS::S3::Bucket.FilterRule" + }, + "type": "array" + } + }, + "required": [ + "Rules" + ], + "type": "object" + }, + "AWS::S3::Bucket.TopicConfiguration": { + "properties": { + "Event": { + "type": "string" + }, + "Filter": { + "$ref": "#/definitions/AWS::S3::Bucket.NotificationFilter" + }, + "Topic": { + "type": "string" + } + }, + "required": [ + "Event", + "Topic" + ], + "type": "object" + }, + "AWS::S3::Bucket.Transition": { + "properties": { + "StorageClass": { + "type": "string" + }, + "TransitionDate": { + "type": "string" + }, + "TransitionInDays": { + "type": "number" + } + }, + "required": [ + "StorageClass" + ], + "type": "object" + }, + "AWS::S3::Bucket.VersioningConfiguration": { + "properties": { + "Status": { + "type": "string" + } + }, + "required": [ + "Status" + ], + "type": "object" + }, + "AWS::S3::Bucket.WebsiteConfiguration": { + "properties": { + "ErrorDocument": { + "type": "string" + }, + "IndexDocument": { + "type": "string" + }, + "RedirectAllRequestsTo": { + "$ref": "#/definitions/AWS::S3::Bucket.RedirectAllRequestsTo" + }, + "RoutingRules": { + "items": { + "$ref": "#/definitions/AWS::S3::Bucket.RoutingRule" + }, + "type": "array" + } + }, + "type": "object" + }, + "AWS::S3::BucketPolicy": { + "properties": { + "Bucket": { + "type": "string" + }, + "PolicyDocument": { + "type": "object" + } + }, + "required": [ + "Bucket", + "PolicyDocument" + ], + "type": "object" + }, + "AWS::SDB::Domain": { + "properties": { + "Description": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::SNS::Subscription": { + "properties": { + "Endpoint": { + "type": "string" + }, + "Protocol": { + "type": "string" + }, + "TopicArn": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::SNS::Topic": { + "properties": { + "DisplayName": { + "type": "string" + }, + "Subscription": { + "items": { + "$ref": "#/definitions/AWS::SNS::Topic.Subscription" + }, + "type": "array" + }, + "TopicName": { + "type": "string" + } + }, + "type": "object" + }, + "AWS::SNS::Topic.Subscription": { + "properties": { + "Endpoint": { + "type": "string" + }, + "Protocol": { + "type": "string" + } + }, + "required": [ + "Endpoint", + "Protocol" + ], + "type": "object" + }, + "AWS::SNS::TopicPolicy": { + "properties": { + "PolicyDocument": { + "type": "object" + }, + "Topics": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "PolicyDocument", + "Topics" + ], + "type": "object" + }, + "AWS::SQS::Queue": { + "properties": { + "ContentBasedDeduplication": { + "type": "boolean" + }, + "DelaySeconds": { + "type": "number" + }, + "FifoQueue": { + "type": "boolean" + }, + "MaximumMessageSize": { + "type": "number" + }, + "MessageRetentionPeriod": { + "type": "number" + }, + "QueueName": { + "type": "string" + }, + "ReceiveMessageWaitTimeSeconds": { + "type": "number" + }, + "RedrivePolicy": { + "type": "object" + }, + "VisibilityTimeout": { + "type": "number" + } + }, + "type": "object" + }, + "AWS::SQS::QueuePolicy": { + "properties": { + "PolicyDocument": { + "type": "object" + }, + "Queues": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "PolicyDocument", + "Queues" + ], + "type": "object" + }, + "AWS::SSM::Association": { + "properties": { + "DocumentVersion": { + "type": "string" + }, + "InstanceId": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Parameters": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "$ref": "#/definitions/AWS::SSM::Association.ParameterValues" + } + }, + "type": "object" + }, + "ScheduleExpression": { + "type": "string" + }, + "Targets": { + "items": { + "$ref": "#/definitions/AWS::SSM::Association.Target" + }, + "type": "array" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::SSM::Association.ParameterValues": { + "properties": { + "ParameterValues": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "ParameterValues" + ], + "type": "object" + }, + "AWS::SSM::Association.Target": { + "properties": { + "Key": { + "type": "string" + }, + "Values": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "Key", + "Values" + ], + "type": "object" + }, + "AWS::SSM::Document": { + "properties": { + "Content": { + "type": "object" + }, + "DocumentType": { + "type": "string" + } + }, + "required": [ + "Content" + ], + "type": "object" + }, + "AWS::SSM::Parameter": { + "properties": { + "Description": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Type", + "Value" + ], + "type": "object" + }, + "AWS::StepFunctions::Activity": { + "properties": { + "Name": { + "type": "string" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::StepFunctions::StateMachine": { + "properties": { + "DefinitionString": { + "type": "string" + }, + "RoleArn": { + "type": "string" + } + }, + "required": [ + "DefinitionString", + "RoleArn" + ], + "type": "object" + }, + "AWS::WAF::ByteMatchSet": { + "properties": { + "ByteMatchTuples": { + "items": { + "$ref": "#/definitions/AWS::WAF::ByteMatchSet.ByteMatchTuple" + }, + "type": "array" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::WAF::ByteMatchSet.ByteMatchTuple": { + "properties": { + "FieldToMatch": { + "$ref": "#/definitions/AWS::WAF::ByteMatchSet.FieldToMatch" + }, + "PositionalConstraint": { + "type": "string" + }, + "TargetString": { + "type": "string" + }, + "TargetStringBase64": { + "type": "string" + }, + "TextTransformation": { + "type": "string" + } + }, + "required": [ + "FieldToMatch", + "PositionalConstraint", + "TextTransformation" + ], + "type": "object" + }, + "AWS::WAF::ByteMatchSet.FieldToMatch": { + "properties": { + "Data": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAF::IPSet": { + "properties": { + "IPSetDescriptors": { + "items": { + "$ref": "#/definitions/AWS::WAF::IPSet.IPSetDescriptor" + }, + "type": "array" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::WAF::IPSet.IPSetDescriptor": { + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Type", + "Value" + ], + "type": "object" + }, + "AWS::WAF::Rule": { + "properties": { + "MetricName": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Predicates": { + "items": { + "$ref": "#/definitions/AWS::WAF::Rule.Predicate" + }, + "type": "array" + } + }, + "required": [ + "MetricName", + "Name" + ], + "type": "object" + }, + "AWS::WAF::Rule.Predicate": { + "properties": { + "DataId": { + "type": "string" + }, + "Negated": { + "type": "boolean" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "DataId", + "Negated", + "Type" + ], + "type": "object" + }, + "AWS::WAF::SizeConstraintSet": { + "properties": { + "Name": { + "type": "string" + }, + "SizeConstraints": { + "items": { + "$ref": "#/definitions/AWS::WAF::SizeConstraintSet.SizeConstraint" + }, + "type": "array" + } + }, + "required": [ + "Name", + "SizeConstraints" + ], + "type": "object" + }, + "AWS::WAF::SizeConstraintSet.FieldToMatch": { + "properties": { + "Data": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAF::SizeConstraintSet.SizeConstraint": { + "properties": { + "ComparisonOperator": { + "type": "string" + }, + "FieldToMatch": { + "$ref": "#/definitions/AWS::WAF::SizeConstraintSet.FieldToMatch" + }, + "Size": { + "type": "number" + }, + "TextTransformation": { + "type": "string" + } + }, + "required": [ + "ComparisonOperator", + "FieldToMatch", + "Size", + "TextTransformation" + ], + "type": "object" + }, + "AWS::WAF::SqlInjectionMatchSet": { + "properties": { + "Name": { + "type": "string" + }, + "SqlInjectionMatchTuples": { + "items": { + "$ref": "#/definitions/AWS::WAF::SqlInjectionMatchSet.SqlInjectionMatchTuple" + }, + "type": "array" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::WAF::SqlInjectionMatchSet.FieldToMatch": { + "properties": { + "Data": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAF::SqlInjectionMatchSet.SqlInjectionMatchTuple": { + "properties": { + "FieldToMatch": { + "$ref": "#/definitions/AWS::WAF::SqlInjectionMatchSet.FieldToMatch" + }, + "TextTransformation": { + "type": "string" + } + }, + "required": [ + "FieldToMatch", + "TextTransformation" + ], + "type": "object" + }, + "AWS::WAF::WebACL": { + "properties": { + "DefaultAction": { + "$ref": "#/definitions/AWS::WAF::WebACL.WafAction" + }, + "MetricName": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Rules": { + "items": { + "$ref": "#/definitions/AWS::WAF::WebACL.ActivatedRule" + }, + "type": "array" + } + }, + "required": [ + "DefaultAction", + "MetricName", + "Name" + ], + "type": "object" + }, + "AWS::WAF::WebACL.ActivatedRule": { + "properties": { + "Action": { + "$ref": "#/definitions/AWS::WAF::WebACL.WafAction" + }, + "Priority": { + "type": "number" + }, + "RuleId": { + "type": "string" + } + }, + "required": [ + "Action", + "Priority", + "RuleId" + ], + "type": "object" + }, + "AWS::WAF::WebACL.WafAction": { + "properties": { + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAF::XssMatchSet": { + "properties": { + "Name": { + "type": "string" + }, + "XssMatchTuples": { + "items": { + "$ref": "#/definitions/AWS::WAF::XssMatchSet.XssMatchTuple" + }, + "type": "array" + } + }, + "required": [ + "Name", + "XssMatchTuples" + ], + "type": "object" + }, + "AWS::WAF::XssMatchSet.FieldToMatch": { + "properties": { + "Data": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAF::XssMatchSet.XssMatchTuple": { + "properties": { + "FieldToMatch": { + "$ref": "#/definitions/AWS::WAF::XssMatchSet.FieldToMatch" + }, + "TextTransformation": { + "type": "string" + } + }, + "required": [ + "FieldToMatch", + "TextTransformation" + ], + "type": "object" + }, + "AWS::WAFRegional::ByteMatchSet": { + "properties": { + "ByteMatchTuples": { + "items": { + "$ref": "#/definitions/AWS::WAFRegional::ByteMatchSet.ByteMatchTuple" + }, + "type": "array" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::WAFRegional::ByteMatchSet.ByteMatchTuple": { + "properties": { + "FieldToMatch": { + "$ref": "#/definitions/AWS::WAFRegional::ByteMatchSet.FieldToMatch" + }, + "PositionalConstraint": { + "type": "string" + }, + "TargetString": { + "type": "string" + }, + "TargetStringBase64": { + "type": "string" + }, + "TextTransformation": { + "type": "string" + } + }, + "required": [ + "FieldToMatch", + "PositionalConstraint", + "TextTransformation" + ], + "type": "object" + }, + "AWS::WAFRegional::ByteMatchSet.FieldToMatch": { + "properties": { + "Data": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAFRegional::IPSet": { + "properties": { + "IPSetDescriptors": { + "items": { + "$ref": "#/definitions/AWS::WAFRegional::IPSet.IPSetDescriptor" + }, + "type": "array" + }, + "Name": { + "type": "string" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::WAFRegional::IPSet.IPSetDescriptor": { + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Type", + "Value" + ], + "type": "object" + }, + "AWS::WAFRegional::Rule": { + "properties": { + "MetricName": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Predicates": { + "items": { + "$ref": "#/definitions/AWS::WAFRegional::Rule.Predicate" + }, + "type": "array" + } + }, + "required": [ + "MetricName", + "Name" + ], + "type": "object" + }, + "AWS::WAFRegional::Rule.Predicate": { + "properties": { + "DataId": { + "type": "string" + }, + "Negated": { + "type": "boolean" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "DataId", + "Negated", + "Type" + ], + "type": "object" + }, + "AWS::WAFRegional::SizeConstraintSet": { + "properties": { + "Name": { + "type": "string" + }, + "SizeConstraints": { + "items": { + "$ref": "#/definitions/AWS::WAFRegional::SizeConstraintSet.SizeConstraint" + }, + "type": "array" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::WAFRegional::SizeConstraintSet.FieldToMatch": { + "properties": { + "Data": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAFRegional::SizeConstraintSet.SizeConstraint": { + "properties": { + "ComparisonOperator": { + "type": "string" + }, + "FieldToMatch": { + "$ref": "#/definitions/AWS::WAFRegional::SizeConstraintSet.FieldToMatch" + }, + "Size": { + "type": "number" + }, + "TextTransformation": { + "type": "string" + } + }, + "required": [ + "ComparisonOperator", + "FieldToMatch", + "Size", + "TextTransformation" + ], + "type": "object" + }, + "AWS::WAFRegional::SqlInjectionMatchSet": { + "properties": { + "Name": { + "type": "string" + }, + "SqlInjectionMatchTuples": { + "items": { + "$ref": "#/definitions/AWS::WAFRegional::SqlInjectionMatchSet.SqlInjectionMatchTuple" + }, + "type": "array" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::WAFRegional::SqlInjectionMatchSet.FieldToMatch": { + "properties": { + "Data": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAFRegional::SqlInjectionMatchSet.SqlInjectionMatchTuple": { + "properties": { + "FieldToMatch": { + "$ref": "#/definitions/AWS::WAFRegional::SqlInjectionMatchSet.FieldToMatch" + }, + "TextTransformation": { + "type": "string" + } + }, + "required": [ + "FieldToMatch", + "TextTransformation" + ], + "type": "object" + }, + "AWS::WAFRegional::WebACL": { + "properties": { + "DefaultAction": { + "$ref": "#/definitions/AWS::WAFRegional::WebACL.Action" + }, + "MetricName": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Rules": { + "items": { + "$ref": "#/definitions/AWS::WAFRegional::WebACL.Rule" + }, + "type": "array" + } + }, + "required": [ + "DefaultAction", + "MetricName", + "Name" + ], + "type": "object" + }, + "AWS::WAFRegional::WebACL.Action": { + "properties": { + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAFRegional::WebACL.Rule": { + "properties": { + "Action": { + "$ref": "#/definitions/AWS::WAFRegional::WebACL.Action" + }, + "Priority": { + "type": "number" + }, + "RuleId": { + "type": "string" + } + }, + "required": [ + "Action", + "Priority", + "RuleId" + ], + "type": "object" + }, + "AWS::WAFRegional::WebACLAssociation": { + "properties": { + "ResourceArn": { + "type": "string" + }, + "WebACLId": { + "type": "string" + } + }, + "required": [ + "ResourceArn", + "WebACLId" + ], + "type": "object" + }, + "AWS::WAFRegional::XssMatchSet": { + "properties": { + "Name": { + "type": "string" + }, + "XssMatchTuples": { + "items": { + "$ref": "#/definitions/AWS::WAFRegional::XssMatchSet.XssMatchTuple" + }, + "type": "array" + } + }, + "required": [ + "Name" + ], + "type": "object" + }, + "AWS::WAFRegional::XssMatchSet.FieldToMatch": { + "properties": { + "Data": { + "type": "string" + }, + "Type": { + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "AWS::WAFRegional::XssMatchSet.XssMatchTuple": { + "properties": { + "FieldToMatch": { + "$ref": "#/definitions/AWS::WAFRegional::XssMatchSet.FieldToMatch" + }, + "TextTransformation": { + "type": "string" + } + }, + "required": [ + "FieldToMatch", + "TextTransformation" + ], + "type": "object" + }, + "AWS::WorkSpaces::Workspace": { + "properties": { + "BundleId": { + "type": "string" + }, + "DirectoryId": { + "type": "string" + }, + "RootVolumeEncryptionEnabled": { + "type": "boolean" + }, + "UserName": { + "type": "string" + }, + "UserVolumeEncryptionEnabled": { + "type": "boolean" + }, + "VolumeEncryptionKey": { + "type": "string" + } + }, + "required": [ + "BundleId", + "DirectoryId", + "UserName" + ], + "type": "object" + }, + "Parameter": { + "additionalProperties": false, + "properties": { + "AllowedPattern": { + "type": "string" + }, + "AllowedValues": { + "type": "array" + }, + "ConstraintDescription": { + "type": "string" + }, + "Default": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "MaxLength": { + "type": "string" + }, + "MaxValue": { + "type": "string" + }, + "MinLength": { + "type": "string" + }, + "MinValue": { + "type": "string" + }, + "NoEcho": { + "type": [ + "string", + "boolean" + ] + }, + "Type": { + "enum": [ + "String", + "Number", + "List\u003cNumber\u003e", + "CommaDelimitedList", + "AWS::EC2::AvailabilityZone::Name", + "AWS::EC2::Image::Id", + "AWS::EC2::Instance::Id", + "AWS::EC2::KeyPair::KeyName", + "AWS::EC2::SecurityGroup::GroupName", + "AWS::EC2::SecurityGroup::Id", + "AWS::EC2::Subnet::Id", + "AWS::EC2::Volume::Id", + "AWS::EC2::VPC::Id", + "AWS::Route53::HostedZone::Id", + "List\u003cAWS::EC2::AvailabilityZone::Name\u003e", + "List\u003cAWS::EC2::Image::Id\u003e", + "List\u003cAWS::EC2::Instance::Id\u003e", + "List\u003cAWS::EC2::SecurityGroup::GroupName\u003e", + "List\u003cAWS::EC2::SecurityGroup::Id\u003e", + "List\u003cAWS::EC2::Subnet::Id\u003e", + "List\u003cAWS::EC2::Volume::Id\u003e", + "List\u003cAWS::EC2::VPC::Id\u003e", + "List\u003cAWS::Route53::HostedZone::Id\u003e", + "List\u003cString\u003e" + ], + "type": "string" + } + }, + "required": [ + "Type" + ], + "type": "object" + }, + "Tag": { + "properties": { + "Key": { + "type": "string" + }, + "Value": { + "type": "string" + } + }, + "required": [ + "Key", + "Value" + ], + "type": "object" + } + }, + "properties": { + "AWSTemplateFormatVersion": { + "enum": [ + "2010-09-09" + ], + "type": "string" + }, + "Conditions": { + "additionalProperties": false, + "patternProperties": { + ".*": { + "type": "object" + } + }, + "type": "object" + }, + "Description": { + "description": "Template description", + "maxLength": 1024, + "type": "string" + }, + "Mappings": { + "additionalProperties": false, + "patternProperties": { + ".*": { + "type": "object" + } + }, + "type": "object" + }, + "Parameters": { + "additionalProperties": false, + "maxProperties": 50, + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "$ref": "#/definitions/Parameter" + } + }, + "type": "object" + }, + "Resources": { + "patternProperties": { + "^[a-zA-Z0-9]+$": { + "anyOf": [ + { + "$ref": "#/definitions/AWS::ApiGateway::Account" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::ApiKey" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::Authorizer" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::BasePathMapping" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::ClientCertificate" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::Deployment" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::DomainName" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::Method" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::Model" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::Resource" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::RestApi" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::Stage" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::UsagePlan" + }, + { + "$ref": "#/definitions/AWS::ApiGateway::UsagePlanKey" + }, + { + "$ref": "#/definitions/AWS::ApplicationAutoScaling::ScalableTarget" + }, + { + "$ref": "#/definitions/AWS::ApplicationAutoScaling::ScalingPolicy" + }, + { + "$ref": "#/definitions/AWS::AutoScaling::AutoScalingGroup" + }, + { + "$ref": "#/definitions/AWS::AutoScaling::LaunchConfiguration" + }, + { + "$ref": "#/definitions/AWS::AutoScaling::LifecycleHook" + }, + { + "$ref": "#/definitions/AWS::AutoScaling::ScalingPolicy" + }, + { + "$ref": "#/definitions/AWS::AutoScaling::ScheduledAction" + }, + { + "$ref": "#/definitions/AWS::Batch::ComputeEnvironment" + }, + { + "$ref": "#/definitions/AWS::Batch::JobDefinition" + }, + { + "$ref": "#/definitions/AWS::Batch::JobQueue" + }, + { + "$ref": "#/definitions/AWS::CertificateManager::Certificate" + }, + { + "$ref": "#/definitions/AWS::CloudFormation::CustomResource" + }, + { + "$ref": "#/definitions/AWS::CloudFormation::Stack" + }, + { + "$ref": "#/definitions/AWS::CloudFormation::WaitCondition" + }, + { + "$ref": "#/definitions/AWS::CloudFormation::WaitConditionHandle" + }, + { + "$ref": "#/definitions/AWS::CloudFront::Distribution" + }, + { + "$ref": "#/definitions/AWS::CloudTrail::Trail" + }, + { + "$ref": "#/definitions/AWS::CloudWatch::Alarm" + }, + { + "$ref": "#/definitions/AWS::CloudWatch::Dashboard" + }, + { + "$ref": "#/definitions/AWS::CodeBuild::Project" + }, + { + "$ref": "#/definitions/AWS::CodeCommit::Repository" + }, + { + "$ref": "#/definitions/AWS::CodeDeploy::Application" + }, + { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentConfig" + }, + { + "$ref": "#/definitions/AWS::CodeDeploy::DeploymentGroup" + }, + { + "$ref": "#/definitions/AWS::CodePipeline::CustomActionType" + }, + { + "$ref": "#/definitions/AWS::CodePipeline::Pipeline" + }, + { + "$ref": "#/definitions/AWS::Cognito::IdentityPool" + }, + { + "$ref": "#/definitions/AWS::Cognito::IdentityPoolRoleAttachment" + }, + { + "$ref": "#/definitions/AWS::Cognito::UserPool" + }, + { + "$ref": "#/definitions/AWS::Cognito::UserPoolClient" + }, + { + "$ref": "#/definitions/AWS::Cognito::UserPoolGroup" + }, + { + "$ref": "#/definitions/AWS::Cognito::UserPoolUser" + }, + { + "$ref": "#/definitions/AWS::Cognito::UserPoolUserToGroupAttachment" + }, + { + "$ref": "#/definitions/AWS::Config::ConfigRule" + }, + { + "$ref": "#/definitions/AWS::Config::ConfigurationRecorder" + }, + { + "$ref": "#/definitions/AWS::Config::DeliveryChannel" + }, + { + "$ref": "#/definitions/AWS::DMS::Certificate" + }, + { + "$ref": "#/definitions/AWS::DMS::Endpoint" + }, + { + "$ref": "#/definitions/AWS::DMS::EventSubscription" + }, + { + "$ref": "#/definitions/AWS::DMS::ReplicationInstance" + }, + { + "$ref": "#/definitions/AWS::DMS::ReplicationSubnetGroup" + }, + { + "$ref": "#/definitions/AWS::DMS::ReplicationTask" + }, + { + "$ref": "#/definitions/AWS::DataPipeline::Pipeline" + }, + { + "$ref": "#/definitions/AWS::DirectoryService::MicrosoftAD" + }, + { + "$ref": "#/definitions/AWS::DirectoryService::SimpleAD" + }, + { + "$ref": "#/definitions/AWS::DynamoDB::Table" + }, + { + "$ref": "#/definitions/AWS::EC2::CustomerGateway" + }, + { + "$ref": "#/definitions/AWS::EC2::DHCPOptions" + }, + { + "$ref": "#/definitions/AWS::EC2::EIP" + }, + { + "$ref": "#/definitions/AWS::EC2::EIPAssociation" + }, + { + "$ref": "#/definitions/AWS::EC2::EgressOnlyInternetGateway" + }, + { + "$ref": "#/definitions/AWS::EC2::FlowLog" + }, + { + "$ref": "#/definitions/AWS::EC2::Host" + }, + { + "$ref": "#/definitions/AWS::EC2::Instance" + }, + { + "$ref": "#/definitions/AWS::EC2::InternetGateway" + }, + { + "$ref": "#/definitions/AWS::EC2::NatGateway" + }, + { + "$ref": "#/definitions/AWS::EC2::NetworkAcl" + }, + { + "$ref": "#/definitions/AWS::EC2::NetworkAclEntry" + }, + { + "$ref": "#/definitions/AWS::EC2::NetworkInterface" + }, + { + "$ref": "#/definitions/AWS::EC2::NetworkInterfaceAttachment" + }, + { + "$ref": "#/definitions/AWS::EC2::NetworkInterfacePermission" + }, + { + "$ref": "#/definitions/AWS::EC2::PlacementGroup" + }, + { + "$ref": "#/definitions/AWS::EC2::Route" + }, + { + "$ref": "#/definitions/AWS::EC2::RouteTable" + }, + { + "$ref": "#/definitions/AWS::EC2::SecurityGroup" + }, + { + "$ref": "#/definitions/AWS::EC2::SecurityGroupEgress" + }, + { + "$ref": "#/definitions/AWS::EC2::SecurityGroupIngress" + }, + { + "$ref": "#/definitions/AWS::EC2::SpotFleet" + }, + { + "$ref": "#/definitions/AWS::EC2::Subnet" + }, + { + "$ref": "#/definitions/AWS::EC2::SubnetCidrBlock" + }, + { + "$ref": "#/definitions/AWS::EC2::SubnetNetworkAclAssociation" + }, + { + "$ref": "#/definitions/AWS::EC2::SubnetRouteTableAssociation" + }, + { + "$ref": "#/definitions/AWS::EC2::TrunkInterfaceAssociation" + }, + { + "$ref": "#/definitions/AWS::EC2::VPC" + }, + { + "$ref": "#/definitions/AWS::EC2::VPCCidrBlock" + }, + { + "$ref": "#/definitions/AWS::EC2::VPCDHCPOptionsAssociation" + }, + { + "$ref": "#/definitions/AWS::EC2::VPCEndpoint" + }, + { + "$ref": "#/definitions/AWS::EC2::VPCGatewayAttachment" + }, + { + "$ref": "#/definitions/AWS::EC2::VPCPeeringConnection" + }, + { + "$ref": "#/definitions/AWS::EC2::VPNConnection" + }, + { + "$ref": "#/definitions/AWS::EC2::VPNConnectionRoute" + }, + { + "$ref": "#/definitions/AWS::EC2::VPNGateway" + }, + { + "$ref": "#/definitions/AWS::EC2::VPNGatewayRoutePropagation" + }, + { + "$ref": "#/definitions/AWS::EC2::Volume" + }, + { + "$ref": "#/definitions/AWS::EC2::VolumeAttachment" + }, + { + "$ref": "#/definitions/AWS::ECR::Repository" + }, + { + "$ref": "#/definitions/AWS::ECS::Cluster" + }, + { + "$ref": "#/definitions/AWS::ECS::Service" + }, + { + "$ref": "#/definitions/AWS::ECS::TaskDefinition" + }, + { + "$ref": "#/definitions/AWS::EFS::FileSystem" + }, + { + "$ref": "#/definitions/AWS::EFS::MountTarget" + }, + { + "$ref": "#/definitions/AWS::EMR::Cluster" + }, + { + "$ref": "#/definitions/AWS::EMR::InstanceFleetConfig" + }, + { + "$ref": "#/definitions/AWS::EMR::InstanceGroupConfig" + }, + { + "$ref": "#/definitions/AWS::EMR::SecurityConfiguration" + }, + { + "$ref": "#/definitions/AWS::EMR::Step" + }, + { + "$ref": "#/definitions/AWS::ElastiCache::CacheCluster" + }, + { + "$ref": "#/definitions/AWS::ElastiCache::ParameterGroup" + }, + { + "$ref": "#/definitions/AWS::ElastiCache::ReplicationGroup" + }, + { + "$ref": "#/definitions/AWS::ElastiCache::SecurityGroup" + }, + { + "$ref": "#/definitions/AWS::ElastiCache::SecurityGroupIngress" + }, + { + "$ref": "#/definitions/AWS::ElastiCache::SubnetGroup" + }, + { + "$ref": "#/definitions/AWS::ElasticBeanstalk::Application" + }, + { + "$ref": "#/definitions/AWS::ElasticBeanstalk::ApplicationVersion" + }, + { + "$ref": "#/definitions/AWS::ElasticBeanstalk::ConfigurationTemplate" + }, + { + "$ref": "#/definitions/AWS::ElasticBeanstalk::Environment" + }, + { + "$ref": "#/definitions/AWS::ElasticLoadBalancing::LoadBalancer" + }, + { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::Listener" + }, + { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::ListenerRule" + }, + { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::LoadBalancer" + }, + { + "$ref": "#/definitions/AWS::ElasticLoadBalancingV2::TargetGroup" + }, + { + "$ref": "#/definitions/AWS::Elasticsearch::Domain" + }, + { + "$ref": "#/definitions/AWS::Events::Rule" + }, + { + "$ref": "#/definitions/AWS::GameLift::Alias" + }, + { + "$ref": "#/definitions/AWS::GameLift::Build" + }, + { + "$ref": "#/definitions/AWS::GameLift::Fleet" + }, + { + "$ref": "#/definitions/AWS::IAM::AccessKey" + }, + { + "$ref": "#/definitions/AWS::IAM::Group" + }, + { + "$ref": "#/definitions/AWS::IAM::InstanceProfile" + }, + { + "$ref": "#/definitions/AWS::IAM::ManagedPolicy" + }, + { + "$ref": "#/definitions/AWS::IAM::Policy" + }, + { + "$ref": "#/definitions/AWS::IAM::Role" + }, + { + "$ref": "#/definitions/AWS::IAM::User" + }, + { + "$ref": "#/definitions/AWS::IAM::UserToGroupAddition" + }, + { + "$ref": "#/definitions/AWS::IoT::Certificate" + }, + { + "$ref": "#/definitions/AWS::IoT::Policy" + }, + { + "$ref": "#/definitions/AWS::IoT::PolicyPrincipalAttachment" + }, + { + "$ref": "#/definitions/AWS::IoT::Thing" + }, + { + "$ref": "#/definitions/AWS::IoT::ThingPrincipalAttachment" + }, + { + "$ref": "#/definitions/AWS::IoT::TopicRule" + }, + { + "$ref": "#/definitions/AWS::KMS::Alias" + }, + { + "$ref": "#/definitions/AWS::KMS::Key" + }, + { + "$ref": "#/definitions/AWS::Kinesis::Stream" + }, + { + "$ref": "#/definitions/AWS::KinesisAnalytics::Application" + }, + { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationOutput" + }, + { + "$ref": "#/definitions/AWS::KinesisAnalytics::ApplicationReferenceDataSource" + }, + { + "$ref": "#/definitions/AWS::KinesisFirehose::DeliveryStream" + }, + { + "$ref": "#/definitions/AWS::Lambda::Alias" + }, + { + "$ref": "#/definitions/AWS::Lambda::EventSourceMapping" + }, + { + "$ref": "#/definitions/AWS::Lambda::Function" + }, + { + "$ref": "#/definitions/AWS::Lambda::Permission" + }, + { + "$ref": "#/definitions/AWS::Lambda::Version" + }, + { + "$ref": "#/definitions/AWS::Logs::Destination" + }, + { + "$ref": "#/definitions/AWS::Logs::LogGroup" + }, + { + "$ref": "#/definitions/AWS::Logs::LogStream" + }, + { + "$ref": "#/definitions/AWS::Logs::MetricFilter" + }, + { + "$ref": "#/definitions/AWS::Logs::SubscriptionFilter" + }, + { + "$ref": "#/definitions/AWS::OpsWorks::App" + }, + { + "$ref": "#/definitions/AWS::OpsWorks::ElasticLoadBalancerAttachment" + }, + { + "$ref": "#/definitions/AWS::OpsWorks::Instance" + }, + { + "$ref": "#/definitions/AWS::OpsWorks::Layer" + }, + { + "$ref": "#/definitions/AWS::OpsWorks::Stack" + }, + { + "$ref": "#/definitions/AWS::OpsWorks::UserProfile" + }, + { + "$ref": "#/definitions/AWS::OpsWorks::Volume" + }, + { + "$ref": "#/definitions/AWS::RDS::DBCluster" + }, + { + "$ref": "#/definitions/AWS::RDS::DBClusterParameterGroup" + }, + { + "$ref": "#/definitions/AWS::RDS::DBInstance" + }, + { + "$ref": "#/definitions/AWS::RDS::DBParameterGroup" + }, + { + "$ref": "#/definitions/AWS::RDS::DBSecurityGroup" + }, + { + "$ref": "#/definitions/AWS::RDS::DBSecurityGroupIngress" + }, + { + "$ref": "#/definitions/AWS::RDS::DBSubnetGroup" + }, + { + "$ref": "#/definitions/AWS::RDS::EventSubscription" + }, + { + "$ref": "#/definitions/AWS::RDS::OptionGroup" + }, + { + "$ref": "#/definitions/AWS::Redshift::Cluster" + }, + { + "$ref": "#/definitions/AWS::Redshift::ClusterParameterGroup" + }, + { + "$ref": "#/definitions/AWS::Redshift::ClusterSecurityGroup" + }, + { + "$ref": "#/definitions/AWS::Redshift::ClusterSecurityGroupIngress" + }, + { + "$ref": "#/definitions/AWS::Redshift::ClusterSubnetGroup" + }, + { + "$ref": "#/definitions/AWS::Route53::HealthCheck" + }, + { + "$ref": "#/definitions/AWS::Route53::HostedZone" + }, + { + "$ref": "#/definitions/AWS::Route53::RecordSet" + }, + { + "$ref": "#/definitions/AWS::Route53::RecordSetGroup" + }, + { + "$ref": "#/definitions/AWS::S3::Bucket" + }, + { + "$ref": "#/definitions/AWS::S3::BucketPolicy" + }, + { + "$ref": "#/definitions/AWS::SDB::Domain" + }, + { + "$ref": "#/definitions/AWS::SNS::Subscription" + }, + { + "$ref": "#/definitions/AWS::SNS::Topic" + }, + { + "$ref": "#/definitions/AWS::SNS::TopicPolicy" + }, + { + "$ref": "#/definitions/AWS::SQS::Queue" + }, + { + "$ref": "#/definitions/AWS::SQS::QueuePolicy" + }, + { + "$ref": "#/definitions/AWS::SSM::Association" + }, + { + "$ref": "#/definitions/AWS::SSM::Document" + }, + { + "$ref": "#/definitions/AWS::SSM::Parameter" + }, + { + "$ref": "#/definitions/AWS::StepFunctions::Activity" + }, + { + "$ref": "#/definitions/AWS::StepFunctions::StateMachine" + }, + { + "$ref": "#/definitions/AWS::WAF::ByteMatchSet" + }, + { + "$ref": "#/definitions/AWS::WAF::IPSet" + }, + { + "$ref": "#/definitions/AWS::WAF::Rule" + }, + { + "$ref": "#/definitions/AWS::WAF::SizeConstraintSet" + }, + { + "$ref": "#/definitions/AWS::WAF::SqlInjectionMatchSet" + }, + { + "$ref": "#/definitions/AWS::WAF::WebACL" + }, + { + "$ref": "#/definitions/AWS::WAF::XssMatchSet" + }, + { + "$ref": "#/definitions/AWS::WAFRegional::ByteMatchSet" + }, + { + "$ref": "#/definitions/AWS::WAFRegional::IPSet" + }, + { + "$ref": "#/definitions/AWS::WAFRegional::Rule" + }, + { + "$ref": "#/definitions/AWS::WAFRegional::SizeConstraintSet" + }, + { + "$ref": "#/definitions/AWS::WAFRegional::SqlInjectionMatchSet" + }, + { + "$ref": "#/definitions/AWS::WAFRegional::WebACL" + }, + { + "$ref": "#/definitions/AWS::WAFRegional::WebACLAssociation" + }, + { + "$ref": "#/definitions/AWS::WAFRegional::XssMatchSet" + }, + { + "$ref": "#/definitions/AWS::WorkSpaces::Workspace" + } + ] + } + }, + "type": "object" + } + }, + "type": "object" +} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/api-swagger-plain.yaml b/vendor/github.com/awslabs/goformation/test/yaml/api-swagger-plain.yaml new file mode 100644 index 0000000000..cc7f499ce4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/api-swagger-plain.yaml @@ -0,0 +1,1111 @@ +AWSTemplateFormatVersion: "2010-09-09" +Description: "Swagger demo for Integration Requests" +Outputs: + NotifyUrl: + Description: "Notify Workflow URL" + Value: "https://${StepFunctionsAPI}.execute-api.${AWS::Region}.amazonaws.com/dev/notify" + StepFunctionsStateMachine: + Description: "Step Functions State Machine ARN" + Value: StepFunctionStateMachine +Parameters: + NotificationEmail: + Description: "Email address to subscribe to SNS topic and receive notifications from Notifier Workflow" + Type: String + SlackToken: + Default: None + Description: "Legacy Slack Token (xoxp-ywz) to send messages on channel" + Type: String +Resources: + AnotherRandomAPI: + Properties: + DefinitionBody: + basePath: /v2 + definitions: + ApiResponse: + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + xml: + name: "##default" + Category: + properties: + id: + format: int64 + type: integer + name: + type: string + xml: + name: Category + Order: + properties: + complete: + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: "Order Status" + enum: + - placed + - approved + - delivered + type: string + xml: + name: Order + Pet: + properties: + category: + $ref: "#/definitions/Category" + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: "pet status in the store" + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: "#/definitions/Tag" + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + xml: + name: Pet + Tag: + properties: + id: + format: int64 + type: integer + name: + type: string + xml: + name: Tag + User: + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: "User Status" + format: int32 + type: integer + username: + type: string + xml: + name: User + externalDocs: + description: "Find out more about Swagger" + url: "http://swagger.io" + info: + contact: + email: apiteam@swagger.io + description: "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters" + license: + name: "Apache 2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0.html" + termsOfService: "http://swagger.io/terms/" + title: "Swagger Petstore YAML" + version: "1.0.0" + paths: + /pet: + post: + consumes: + - application/json + - application/xml + description: "" + operationId: addPet + parameters: + - + description: "Pet object that needs to be added to the store" + in: body + name: body + required: false + schema: + $ref: "#/definitions/Pet" + produces: + - application/xml + - application/json + responses: + "405": + description: "Invalid input" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Add a new pet to the store" + tags: + - pet + x-swagger-router-controller: SampleController + put: + consumes: + - application/json + - application/xml + description: "" + operationId: updatePet + parameters: + - + description: "Pet object that needs to be added to the store" + in: body + name: body + required: false + schema: + $ref: "#/definitions/Pet" + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid ID supplied" + "404": + description: "Pet not found" + "405": + description: "Validation exception" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Update an existing pet" + tags: + - pet + /pet/findByStatus: + get: + consumes: + - application/xml + - application/json + - multipart/form-data + - application/x-www-form-urlencoded + description: "Multiple status values can be provided with comma seperated strings" + operationId: findPetsByStatus + parameters: + - + collectionFormat: multi + default: available + description: "Status values that need to be considered for filter" + enum: + - available + - pending + - sold + in: query + items: + type: string + name: status + required: false + type: array + - + collectionFormat: multi + default: available + description: "Status values that need to be considered for filter" + enum: + - 1234567890123456 + - 345 + - 678 + in: query + items: + type: long + name: testlong + required: false + type: array + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + items: + $ref: "#/definitions/Pet" + type: array + "400": + description: "Invalid status value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Finds Pets by status" + tags: + - pet + /pet/findByTags: + get: + description: "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - + collectionFormat: multi + description: "Tags to filter by" + in: query + items: + type: string + name: tags + required: false + type: array + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + items: + $ref: "#/definitions/Pet" + type: array + "400": + description: "Invalid tag value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Finds Pets by tags" + tags: + - pet + ? "/pet/{petId}" + : + delete: + consumes: + - multipart/form-data + - application/x-www-form-urlencoded + description: "" + operationId: deletePet + parameters: + - + description: "" + in: header + name: api_key + required: false + type: string + - + description: "Pet id to delete" + format: int64 + in: path + name: petId + required: true + type: integer + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid pet value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Deletes a pet" + tags: + - pet + get: + consumes: + - application/x-www-form-urlencoded + description: "Returns a single pet" + operationId: getPetById + parameters: + - + description: "ID of pet to return" + format: int64 + in: path + name: petId + required: true + type: integer + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/Pet" + "400": + description: "Invalid ID supplied" + "404": + description: "Pet not found" + security: + - + api_key: [] + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Find pet by ID" + tags: + - pet + post: + consumes: + - application/x-www-form-urlencoded + description: "" + operationId: updatePetWithForm + parameters: + - + description: "ID of pet that needs to be updated" + in: path + name: petId + required: true + type: string + - + description: "Updated name of the pet" + in: formData + name: name + required: false + type: string + - + description: "Updated status of the pet" + in: formData + name: status + required: false + type: string + produces: + - application/xml + - application/json + responses: + "405": + description: "Invalid input" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Updates a pet in the store with form data" + tags: + - pet + ? "/pet/{petId}/uploadImage" + : + post: + consumes: + - multipart/form-data + description: "" + operationId: uploadFile + parameters: + - + description: "ID of pet to update" + format: int64 + in: path + name: petId + required: true + type: integer + - + description: "Additional data to pass to server" + in: formData + name: additionalMetadata + required: false + type: string + - + description: "file to upload" + in: formData + name: file + required: false + type: file + produces: + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/ApiResponse" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "uploads an image" + tags: + - pet + x-swagger-router-controller: SampleController + /store/inventory: + get: + description: "Returns a map of status codes to quantities" + operationId: getInventory + parameters: [] + produces: + - application/json + responses: + "200": + description: "successful operation" + schema: + additionalProperties: + format: int32 + type: integer + type: object + security: + - + api_key: [] + summary: "Returns pet inventories by status" + tags: + - store + /store/order: + post: + description: "" + operationId: placeOrder + parameters: + - + description: "order placed for purchasing the pet" + in: body + name: body + required: false + schema: + $ref: "#/definitions/Order" + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/Order" + "400": + description: "Invalid Order" + summary: "Place an order for a pet" + tags: + - store + ? "/store/order/{orderId}" + : + delete: + description: "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors" + operationId: deleteOrder + parameters: + - + description: "ID of the order that needs to be deleted" + in: path + name: orderId + required: true + type: string + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid ID supplied" + "404": + description: "Order not found" + summary: "Delete purchase order by ID" + tags: + - store + get: + description: "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" + operationId: getOrderById + parameters: + - + description: "ID of pet that needs to be fetched" + in: path + name: orderId + required: true + type: string + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/Order" + "400": + description: "Invalid ID supplied" + "404": + description: "Order not found" + summary: "Find purchase order by ID" + tags: + - store + /user: + post: + description: "This can only be done by the logged in user." + operationId: createUser + parameters: + - + description: "Created user object" + in: body + name: body + required: false + schema: + $ref: "#/definitions/User" + produces: + - application/xml + - application/json + responses: + default: + description: "successful operation" + summary: "Create user" + tags: + - user + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + parameters: + - + description: "List of user object" + in: body + name: body + required: false + schema: + items: + $ref: "#/definitions/User" + type: array + produces: + - application/xml + - application/json + responses: + default: + description: "successful operation" + summary: "Creates list of users with given input array" + tags: + - user + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + parameters: + - + description: "List of user object" + in: body + name: body + required: false + schema: + items: + $ref: "#/definitions/User" + type: array + produces: + - application/xml + - application/json + responses: + default: + description: "successful operation" + summary: "Creates list of users with given input array" + tags: + - user + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - + description: "The user name for login" + in: query + name: username + required: false + type: string + - + description: "The password for login in clear text" + in: query + name: password + required: false + type: string + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + headers: + X-Expires-After: + description: "date in UTC when toekn expires" + format: date-time + type: string + X-Rate-Limit: + description: "calls per hour allowed by the user" + format: int32 + type: integer + schema: + type: string + "400": + description: "Invalid username/password supplied" + summary: "Logs user into the system" + tags: + - user + /user/logout: + get: + description: "" + operationId: logoutUser + parameters: [] + produces: + - application/xml + - application/json + responses: + default: + description: "successful operation" + summary: "Logs out current logged in user session" + tags: + - user + ? "/user/{username}" + : + delete: + description: "This can only be done by the logged in user." + operationId: deleteUser + parameters: + - + description: "The name that needs to be deleted" + in: path + name: username + required: true + type: string + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid username supplied" + "404": + description: "User not found" + summary: "Delete user" + tags: + - user + get: + description: "" + operationId: getUserByName + parameters: + - + description: "The name that needs to be fetched. Use user1 for testing. " + in: path + name: username + required: true + type: string + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/User" + "400": + description: "Invalid username supplied" + "404": + description: "User not found" + summary: "Get user by user name" + tags: + - user + put: + description: "This can only be done by the logged in user." + operationId: updateUser + parameters: + - + description: "name that need to be deleted" + in: path + name: username + required: true + type: string + - + description: "Updated user object" + in: body + name: body + required: false + schema: + $ref: "#/definitions/User" + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid user supplied" + "404": + description: "User not found" + summary: "Updated user" + tags: + - user + schemes: + - http + securityDefinitions: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" + flow: implicit + scopes: + ? "read:pets" + : "read your pets" + ? "write:pets" + : "modify pets in your account" + type: oauth2 + swagger: "2.0" + tags: + - + description: "Everything about your Pets" + externalDocs: + description: "Find out more" + url: "http://swagger.io" + name: pet + - + description: "Operations about user" + name: store + - + description: "Access to Petstore orders" + externalDocs: + description: "Find out more about our store" + url: "http://swagger.io" + name: user + StageName: prod + Type: "AWS::Serverless::Api" + ApiGatewayStepFunctionsRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - + Action: + - "sts:AssumeRole" + Effect: Allow + Principal: + Service: + - apigateway.amazonaws.com + Sid: AllowApiGatewayServiceToAssumeRole + Version: "2012-10-17" + Path: / + Policies: + - + PolicyDocument: + Statement: + - + Action: + - "states:StartExecution" + Effect: Allow + Resource: + - StepFunctionStateMachine + Version: "2012-10-17" + PolicyName: CallStepFunctions + Type: "AWS::IAM::Role" + EmailNotifierServiceFunction: + Properties: + CodeUri: ../code/email/ + Environment: + Variables: + NOTIFIER_TOPIC: NotifierSNSTopic + Handler: email_sns.lambda_handler + Role: SnsNotifierServiceRole.Arn + Runtime: python2.7 + Type: "AWS::Serverless::Function" + NotifierSNSTopic: + Properties: + Subscription: + - + Endpoint: NotificationEmail + Protocol: email + Type: "AWS::SNS::Topic" + SlackNotifierServiceFunction: + Properties: + CodeUri: ../code/slack.zip + Environment: + Variables: + SLACK_TOKEN: SlackToken + Handler: slack.lambda_handler + Runtime: python2.7 + Type: "AWS::Serverless::Function" + SmsNotifierServiceFunction: + Properties: + CodeUri: ../code/sms/ + Environment: + Variables: + NOTIFIER_TOPIC: NotifierSNSTopic + Handler: sms_sns.lambda_handler + Role: SnsNotifierServiceRole.Arn + Runtime: python2.7 + Type: "AWS::Serverless::Function" + SnsNotifierServiceRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - + Action: + - "sts:AssumeRole" + Effect: Allow + Principal: + Service: + - lambda.amazonaws.com + Sid: AllowLambdaServiceToAssumeRole + Version: "2012-10-17" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + Path: / + Policies: + - + PolicyDocument: + Statement: + - + Action: + - "sns:Publish" + Effect: Allow + Resource: + - NotifierSNSTopic + - "*" + Version: "2012-10-17" + PolicyName: PublishSnsTopic + Type: "AWS::IAM::Role" + StepFunctionStateMachine: + Properties: + DefinitionString: | + { + "Comment": "Demo for API GW->SFN", + "StartAt": "NotifierState", + "States": { + "NotifierState": { + "Type" : "Choice", + "Choices": [ + { + "Variable": "$.notifier", + "StringEquals": "Email", + "Next": "EmailNotifier" + }, + { + "Variable": "$.notifier", + "StringEquals": "Sms", + "Next": "SmsNotifier" + }, + { + "Variable": "$.notifier", + "StringEquals": "Slack", + "Next": "SlackNotifier" + }, + { + "Variable": "$.notify", + "StringEquals": "Twilio", + "Next": "NotImplementedYet" + } + ], + "Default": "IgnoreNotification" + }, + "IgnoreNotification": { + "Type": "Pass", + "Next": "SayHi" + }, + "NotImplementedYet": { + "Type": "Fail", + "Cause": "Feature not implemented yet!" + }, + "EmailNotifier": { + "Type": "Task", + "Resource": "${EmailNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SlackNotifier": { + "Type": "Task", + "Resource": "${SlackNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SmsNotifier": { + "Type": "Task", + "Resource": "${SmsNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SayHi": { + "Type": "Pass", + "Result": "Hi!", + "End": true + } + } + } + RoleArn: StepFunctionsServiceRole.Arn + Type: "AWS::StepFunctions::StateMachine" + StepFunctionsAPI: + Properties: + DefinitionBody: + basePath: /prod + definitions: + Empty: + title: "Empty Schema" + type: object + info: + title: AwsSamExample + paths: + /: + options: + consumes: + - application/json + produces: + - application/json + responses: + 200: + description: "200 response" + headers: + Access-Control-Allow-Headers: + type: string + Access-Control-Allow-Methods: + type: string + Access-Control-Allow-Origin: + type: string + schema: + $ref: "#/definitions/Empty" + x-amazon-apigateway-integration: + cacheKeyParameters: [] + cacheNamespace: "cache namespace" + credentials: "arn:aws:iam::012345678901:role/apigateway-invoke-lambda-exec-role" + httpMethod: POST + requestParameters: + integration.request.path.stage: method.request.querystring.version + integration.request.querystring.provider: method.request.querystring.vendor + requestTemplates: + application/json: "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }" + application/xml: "#set ($root=$input.path('$')) $root.name " + responses: + "2\\d{2}": + responseParameters: + method.response.header.requestId: integration.response.header.cid + responseTemplates: + application/json: "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }" + application/xml: "#set ($root=$input.path('$')) $root.name " + statusCode: "200" + "302": + responseParameters: + method.response.header.Location: integration.response.body.redirect.url + statusCode: "302" + default: + responseParameters: + method.response.header.test-method-response-header: "'static value'" + statusCode: "400" + type: aws + uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:012345678901:function:HelloWorld/invocations" + x-amazon-apigateway-any-method: + produces: + - application/json + responses: + 200: + description: "200 response" + schema: + $ref: "#/definitions/Empty" + security: + - + test-authorizer: [] + x-amazon-apigateway-integration: + httpMethod: POST + passthroughBehavior: when_no_match + responses: + default: + statusCode: 200 + type: aws_proxy + uri: EmailNotifierServiceFunction.Arn + "/{proxy+}": + options: + consumes: + - application/json + produces: + - application/json + responses: + 200: + description: "200 response" + headers: + Access-Control-Allow-Headers: + type: string + Access-Control-Allow-Methods: + type: string + Access-Control-Allow-Origin: + type: string + schema: + $ref: "#/definitions/Empty" + x-amazon-apigateway-integration: + passthroughBehavior: when_no_match + requestTemplates: + application/json: "{\"statusCode\": 200}" + responses: + default: + responseParameters: + method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'" + method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'" + method.response.header.Access-Control-Allow-Origin: "'*'" + statusCode: 200 + type: mock + x-amazon-apigateway-any-method: + parameters: + - + in: path + name: proxy + required: true + type: string + produces: + - application/json + responses: {} + x-amazon-apigateway-auth: + type: aws_iam + x-amazon-apigateway-integration: + httpMethod: POST + type: aws_proxy + uri: "arn:aws:apigateway:<>:lambda:path/2015-03-31/functions/arn:aws:lambda:<>:<>:function:${stageVariables.LambdaFunctionName}/invocations" + schemes: + - https + securityDefinitions: + test-authorizer: + in: header + name: Authorization + type: apiKey + x-amazon-apigateway-authorizer: + authorizerCredentials: "arn:aws:iam::account-id:role" + authorizerResultTtlInSeconds: 60 + authorizerUri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:account-id:function:function-name/invocations" + identityValidationExpression: "^x-[a-z]+" + type: token + x-amazon-apigateway-authtype: oauth2 + swagger: "2.0" + StageName: dev + Type: "AWS::Serverless::Api" + StepFunctionsServiceRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - + Action: + - "sts:AssumeRole" + Effect: Allow + Principal: + Service: + - "states.${AWS::Region}.amazonaws.com" + Sid: AllowStepFunctionsServiceToAssumeRole + Version: "2012-10-17" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/AWSStepFunctionsFullAccess" + Path: / + Policies: + - + PolicyDocument: + Statement: + - + Action: + - "lambda:InvokeFunction" + Effect: Allow + Resource: + - "${SlackNotifierServiceFunction.Arn}" + - "${EmailNotifierServiceFunction.Arn}" + - "${SmsNotifierServiceFunction.Arn}" + Version: "2012-10-17" + PolicyName: CallLambdaFunctions + Type: "AWS::IAM::Role" +Transform: "AWS::Serverless-2016-10-31" diff --git a/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-api-swagger.yaml b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-api-swagger.yaml new file mode 100644 index 0000000000..429cb977e8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-api-swagger.yaml @@ -0,0 +1,1038 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Swagger demo for Integration Requests + +Parameters: + + NotificationEmail: + Type: String + Description: Email address to subscribe to SNS topic and receive notifications from Notifier Workflow + + SlackToken: + Type: String + Description: Legacy Slack Token (xoxp-ywz) to send messages on channel + Default: None + +Resources: + + + SnsNotifierServiceRole: + Type: "AWS::IAM::Role" + Properties: + Path: "/" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + AssumeRolePolicyDocument: + Version: "2012-10-17" + Statement: + - + Sid: "AllowLambdaServiceToAssumeRole" + Effect: "Allow" + Action: + - "sts:AssumeRole" + Principal: + Service: + - "lambda.amazonaws.com" + Policies: + - + PolicyName: "PublishSnsTopic" + PolicyDocument: + Version: '2012-10-17' + Statement: + - + Effect: "Allow" + Action: + - "sns:Publish" + Resource: + - !Ref NotifierSNSTopic + - "*" # can't restrict on SMS number yet, so * + + + EmailNotifierServiceFunction: + Type: 'AWS::Serverless::Function' + Properties: + Handler: email_sns.lambda_handler + Runtime: python2.7 + CodeUri: ../code/email/ + Role: !GetAtt SnsNotifierServiceRole.Arn + Environment: + Variables: + NOTIFIER_TOPIC: !Ref NotifierSNSTopic + + + SmsNotifierServiceFunction: + Type: 'AWS::Serverless::Function' + Properties: + Handler: sms_sns.lambda_handler + Runtime: python2.7 + CodeUri: ../code/sms/ + Role: !GetAtt SnsNotifierServiceRole.Arn + Environment: + Variables: + NOTIFIER_TOPIC: !Ref NotifierSNSTopic + + # No need for extra permissions other than Basic Execution + # SAM takes care of creating basic IAM Role if none is provided + SlackNotifierServiceFunction: + Type: 'AWS::Serverless::Function' + Properties: + Handler: slack.lambda_handler + Runtime: python2.7 + CodeUri: ../code/slack.zip # Slack contains 3rd party libraries + Environment: + Variables: + SLACK_TOKEN: !Ref SlackToken + # IAM Role API Gateway will assume in order to call StepFunctions StartExecution API + ApiGatewayStepFunctionsRole: + Type: "AWS::IAM::Role" + Properties: + Path: "/" + AssumeRolePolicyDocument: + Version: "2012-10-17" + Statement: + - + Sid: "AllowApiGatewayServiceToAssumeRole" + Effect: "Allow" + Action: + - "sts:AssumeRole" + Principal: + Service: + - "apigateway.amazonaws.com" + Policies: + - + PolicyName: "CallStepFunctions" + PolicyDocument: + Version: '2012-10-17' + Statement: + - + Effect: "Allow" + Action: + - "states:StartExecution" + Resource: + - !Ref StepFunctionStateMachine + + AnotherRandomAPI: + Type: AWS::Serverless::Api + Properties: + StageName: prod + DefinitionBody: + swagger: "2.0" + info: + description: "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters" + version: 1.0.0 + title: Swagger Petstore YAML + termsOfService: "http://swagger.io/terms/" + contact: + email: "apiteam@swagger.io" + license: + name: Apache 2.0 + url: "http://www.apache.org/licenses/LICENSE-2.0.html" + basePath: /v2 + tags: + - name: pet + description: Everything about your Pets + externalDocs: + description: Find out more + url: "http://swagger.io" + - name: store + description: Operations about user + - name: user + description: Access to Petstore orders + externalDocs: + description: Find out more about our store + url: "http://swagger.io" + schemes: + - http + paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + x-swagger-router-controller: SampleController + description: "" + operationId: addPet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: false + schema: + $ref: "#/definitions/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - "write:pets" + - "read:pets" + put: + tags: + - pet + summary: Update an existing pet + description: "" + operationId: updatePet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: false + schema: + $ref: "#/definitions/Pet" + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma seperated strings + operationId: findPetsByStatus + consumes: + - application/xml + - application/json + - multipart/form-data + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: false + type: array + items: + type: string + collectionFormat: multi + default: available + enum: + - available + - pending + - sold + - name: testlong + in: query + description: Status values that need to be considered for filter + required: false + type: array + items: + type: long + collectionFormat: multi + default: available + enum: + - 1234567890123456 + - 345 + - 678 + responses: + "200": + description: successful operation + schema: + type: array + items: + $ref: "#/definitions/Pet" + "400": + description: Invalid status value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing." + operationId: findPetsByTags + produces: + - application/xml + - application/json + parameters: + - name: tags + in: query + description: Tags to filter by + required: false + type: array + items: + type: string + collectionFormat: multi + responses: + "200": + description: successful operation + schema: + type: array + items: + $ref: "#/definitions/Pet" + "400": + description: Invalid tag value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + "/pet/{petId}": + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + consumes: + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + type: integer + format: int64 + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/Pet" + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + - petstore_auth: + - "write:pets" + - "read:pets" + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: "" + operationId: updatePetWithForm + consumes: + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + type: string + - name: name + in: formData + description: Updated name of the pet + required: false + type: string + - name: status + in: formData + description: Updated status of the pet + required: false + type: string + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - "write:pets" + - "read:pets" + delete: + tags: + - pet + summary: Deletes a pet + description: "" + operationId: deletePet + consumes: + - multipart/form-data + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: api_key + in: header + description: "" + required: false + type: string + - name: petId + in: path + description: Pet id to delete + required: true + type: integer + format: int64 + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + "/pet/{petId}/uploadImage": + post: + tags: + - pet + summary: uploads an image + x-swagger-router-controller: SampleController + description: "" + operationId: uploadFile + consumes: + - multipart/form-data + produces: + - application/json + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + type: integer + format: int64 + - name: additionalMetadata + in: formData + description: Additional data to pass to server + required: false + type: string + - name: file + in: formData + description: file to upload + required: false + type: file + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/ApiResponse" + security: + - petstore_auth: + - "write:pets" + - "read:pets" + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + produces: + - application/json + parameters: [] + responses: + "200": + description: successful operation + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: "" + operationId: placeOrder + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: order placed for purchasing the pet + required: false + schema: + $ref: "#/definitions/Order" + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/Order" + "400": + description: Invalid Order + "/store/order/{orderId}": + get: + tags: + - store + summary: Find purchase order by ID + description: "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" + operationId: getOrderById + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + type: string + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/Order" + "400": + description: Invalid ID supplied + "404": + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + type: string + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Created user object + required: false + schema: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithArrayInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: false + schema: + type: array + items: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithListInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: false + schema: + type: array + items: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: "" + operationId: loginUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: query + description: The user name for login + required: false + type: string + - name: password + in: query + description: The password for login in clear text + required: false + type: string + responses: + "200": + description: successful operation + schema: + type: string + headers: + X-Rate-Limit: + type: integer + format: int32 + description: calls per hour allowed by the user + X-Expires-After: + type: string + format: date-time + description: date in UTC when toekn expires + "400": + description: Invalid username/password supplied + x-amazon-apigateway-integration: + uri: + Fn::GetAtt: [ "SmsNotifierServiceFunction", "Arn" ] + httpMethod: POST + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: "" + operationId: logoutUser + produces: + - application/xml + - application/json + parameters: [] + responses: + default: + description: successful operation + x-amazon-apigateway-integration: + uri: + Fn::Sub: + - "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${FunctionName}/invocations" + - {"FunctionName": !Ref EmailNotifierServiceFunction } + httpMethod: POST + "/user/{username}": + get: + tags: + - user + summary: Get user by user name + description: "" + operationId: getUserByName + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: "The name that needs to be fetched. Use user1 for testing. " + required: true + type: string + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/User" + "400": + description: Invalid username supplied + "404": + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + type: string + - in: body + name: body + description: Updated user object + required: false + schema: + $ref: "#/definitions/User" + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + type: string + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + securityDefinitions: + petstore_auth: + type: oauth2 + authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" + flow: implicit + scopes: + "write:pets": modify pets in your account + "read:pets": read your pets + api_key: + type: apiKey + name: api_key + in: header + definitions: + Order: + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + xml: + name: Order + Category: + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Category + User: + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: "#/definitions/Category" + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: "#/definitions/Tag" + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + xml: + name: "##default" + externalDocs: + description: Find out more about Swagger + url: "http://swagger.io" + StepFunctionsAPI: + Type: AWS::Serverless::Api + Properties: + StageName: dev + DefinitionBody: + swagger: "2.0" + basePath: /prod + info: + title: AwsSamExample + schemes: + - https + paths: + /: + x-amazon-apigateway-any-method: + security: + - test-authorizer: [] + produces: + - application/json + responses: + 200: + description: 200 response + schema: + $ref: "#/definitions/Empty" + x-amazon-apigateway-integration: + responses: + default: + statusCode: 200 + # NOTE: Replace <> and <> fields + uri: arn:aws:apigateway:<>:lambda:path/2015-03-31/functions/arn:aws:lambda:<>:<>:function:${stageVariables.LambdaFunctionName}/invocations + + passthroughBehavior: when_no_match + httpMethod: POST + type: aws_proxy + options: + consumes: + - application/json + produces: + - application/json + responses: + 200: + description: 200 response + schema: + $ref: "#/definitions/Empty" + headers: + Access-Control-Allow-Origin: + type: string + Access-Control-Allow-Methods: + type: string + Access-Control-Allow-Headers: + type: string + x-amazon-apigateway-integration: + type: aws + uri: arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:012345678901:function:HelloWorld/invocations + httpMethod: POST + credentials: arn:aws:iam::012345678901:role/apigateway-invoke-lambda-exec-role + requestTemplates: + application/json: '#set ($root=$input.path(''$'')) { "stage": "$root.name", "user-id": + "$root.key" }' + application/xml: "#set ($root=$input.path('$')) $root.name " + requestParameters: + integration.request.path.stage: method.request.querystring.version + integration.request.querystring.provider: method.request.querystring.vendor + cacheNamespace: cache namespace + cacheKeyParameters: [] + responses: + '302': + statusCode: '302' + responseParameters: + method.response.header.Location: integration.response.body.redirect.url + 2\d{2}: + statusCode: '200' + responseParameters: + method.response.header.requestId: integration.response.header.cid + responseTemplates: + application/json: '#set ($root=$input.path(''$'')) { "stage": "$root.name", + "user-id": "$root.key" }' + application/xml: "#set ($root=$input.path('$')) $root.name " + default: + statusCode: '400' + responseParameters: + method.response.header.test-method-response-header: "'static value'" + x-amazon-apigateway-integration: + uri: !Sub + - "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${EmailNotifierServiceFunction}${Test}/invocations" + - { "Test": "ABCD", "OtherTest": !Ref something } + httpMethod: POST + StepFunctionsServiceRole: + Type: "AWS::IAM::Role" + Properties: + Path: "/" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/AWSStepFunctionsFullAccess" + AssumeRolePolicyDocument: + Version: "2012-10-17" + Statement: + - + Sid: "AllowStepFunctionsServiceToAssumeRole" + Effect: "Allow" + Action: + - "sts:AssumeRole" + Principal: + Service: + - !Sub "states.${AWS::Region}.amazonaws.com" + Policies: + - + PolicyName: "CallLambdaFunctions" + PolicyDocument: + Version: '2012-10-17' + Statement: + - + Effect: "Allow" + Action: + - "lambda:InvokeFunction" + Resource: + - !Sub "${SlackNotifierServiceFunction.Arn}" + - !Sub "${EmailNotifierServiceFunction.Arn}" + - !Sub "${SmsNotifierServiceFunction.Arn}" + + StepFunctionStateMachine: + Type: "AWS::StepFunctions::StateMachine" + Properties: + DefinitionString: !Sub | + { + "Comment": "Demo for API GW->SFN", + "StartAt": "NotifierState", + "States": { + "NotifierState": { + "Type" : "Choice", + "Choices": [ + { + "Variable": "$.notifier", + "StringEquals": "Email", + "Next": "EmailNotifier" + }, + { + "Variable": "$.notifier", + "StringEquals": "Sms", + "Next": "SmsNotifier" + }, + { + "Variable": "$.notifier", + "StringEquals": "Slack", + "Next": "SlackNotifier" + }, + { + "Variable": "$.notify", + "StringEquals": "Twilio", + "Next": "NotImplementedYet" + } + ], + "Default": "IgnoreNotification" + }, + "IgnoreNotification": { + "Type": "Pass", + "Next": "SayHi" + }, + "NotImplementedYet": { + "Type": "Fail", + "Cause": "Feature not implemented yet!" + }, + "EmailNotifier": { + "Type": "Task", + "Resource": "${EmailNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SlackNotifier": { + "Type": "Task", + "Resource": "${SlackNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SmsNotifier": { + "Type": "Task", + "Resource": "${SmsNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SayHi": { + "Type": "Pass", + "Result": "Hi!", + "End": true + } + } + } + RoleArn: !GetAtt StepFunctionsServiceRole.Arn + NotifierSNSTopic: + Type: AWS::SNS::Topic + Properties: + Subscription: + - Endpoint: !Ref NotificationEmail + Protocol: email +Outputs: + NotifyUrl: + Description: Notify Workflow URL + Value: !Sub "https://${StepFunctionsAPI}.execute-api.${AWS::Region}.amazonaws.com/dev/notify" + + StepFunctionsStateMachine: + Description: Step Functions State Machine ARN + Value: !Ref StepFunctionStateMachine \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-2016-10-31.yaml b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-2016-10-31.yaml new file mode 100644 index 0000000000..376ff804c0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-2016-10-31.yaml @@ -0,0 +1,29 @@ +Transform: AWS::Serverless-2016-10-31 +Resources: + Function20161031: + Type: AWS::Serverless::Function + Properties: + Handler: file.method + Runtime: nodejs + CodeUri: s3://bucket/path/key + FunctionName: functionname + Description: description + MemorySize: 128 + Timeout: 30 + Role: aws::arn::123456789012::some/role + Policies: + - AmazonDynamoDBFullAccess + Environment: + Variables: + NAME: VALUE + VpcConfig: + SecurityGroupIds: + - String + SubnetIds: + - String + Events: + TestApi: + Type: Api + Properties: + Path: /testing + Method: any \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-api-event.yaml b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-api-event.yaml new file mode 100644 index 0000000000..649aef9a3e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-api-event.yaml @@ -0,0 +1,53 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Simple CRUD webservice. State is stored in a SimpleTable (DynamoDB) resource. +Resources: + GetFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.get + Runtime: nodejs + CodeUri: s3:///api_backend.zip + Policies: AmazonDynamoDBReadOnlyAccess + Environment: + Variables: + TABLE_NAME: !Ref Table1 + Events: + GetResource: + Type: Api + Properties: + Path: /resource/{resourceId} + Method: get + PutFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.put + Runtime: nodejs4.3 + CodeUri: s3:///api_backend.zip + Policies: AmazonDynamoDBFullAccess + Environment: + Variables: + TABLE_NAME: !Ref Table2 + Events: + PutResource: + Type: Api + Properties: + Path: /resource/{resourceId} + Method: put + + DeleteFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.delete + Runtime: nodejs4.3 + CodeUri: s3:///api_backend.zip + Policies: AmazonDynamoDBFullAccess + Environment: + Variables: + TABLE_NAME: !Ref Table3 + Events: + DeleteResource: + Type: Api + Properties: + Path: /resource/{resourceId} + Method: delete \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-env-vars.yaml b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-env-vars.yaml new file mode 100644 index 0000000000..ea1682cd5e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-env-vars.yaml @@ -0,0 +1,104 @@ +AWSTemplateFormatVersion : '2010-09-09' +Transform: AWS::Serverless-2016-10-31 + +Description: | + Use this section to describe your Serverless project + +Parameters: + # Optional: Use parameters to pass in runtime configuration (such as a database connection string) + # See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html + + ExampleParameter: + Description: This is just an example parameter, used to show how to pass in environment variables to Lambda + Type: String + Default: SomeValue + +Resources: + # Place your project resources here (AWS Lambda functions, API Gateway) etc + + EnvironmentVariableTestFunction: + Type: AWS::Serverless::Function + Properties: + Runtime: nodejs6.10 + Handler: filename.method + Environment: + Variables: + STRING_ENV_VAR: test123 + Events: + GetRequest: + Type: Api + Properties: + Path: / + Method: get + + NoValueEnvironmentVariableTestFunction: + Type: AWS::Serverless::Function + Properties: + Runtime: nodejs6.10 + Handler: filename.method + Environment: + Variables: + EMPTY_ENV_VAR: "" + Events: + GetRequest: + Type: Api + Properties: + Path: / + Method: get + + SubEnvironmentVariableTestFunction: + Type: AWS::Serverless::Function + Properties: + FunctionName: sub + Runtime: nodejs6.10 + Handler: filename.method + Environment: + Variables: + SUB_ENV_VAR: !Sub Hello + Events: + GetRequest: + Type: Api + Properties: + Path: / + Method: get + + NonExistSubEnvironmentVariableTestFunction: + Type: AWS::Serverless::Function + Properties: + FunctionName: sub + Runtime: nodejs6.10 + Handler: filename.method + Environment: + Variables: + SUB_REF_ENV_VAR: !Sub Hello-${ThisReferenceDoesntExist} + Events: + GetRequest: + Type: Api + Properties: + Path: / + Method: get + + IntrinsicEnvironmentVariableTestFunction: + Type: AWS::Serverless::Function + Properties: + Runtime: nodejs6.10 + Handler: filename.method + Environment: + Variables: + REF_ENV_VAR: !Ref ExampleParameter + Events: + GetRequest: + Type: Api + Properties: + Path: / + Method: get + +Outputs: + # Optional: The optional Outputs section declares output values that you can import into other stacks + # (to create cross-stack references), return in response (to describe stack calls), or view on the + # AWS CloudFormation console. + # See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html + + ExampleOutput: + Description: This is an example output, used to show how to return the ARN of the created Lambda function + Value: !Ref ExampleFunction diff --git a/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-string-or-s3-location.yaml b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-string-or-s3-location.yaml new file mode 100644 index 0000000000..f11107a9fd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/aws-serverless-function-string-or-s3-location.yaml @@ -0,0 +1,25 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: SAM template for testing CodeUri property parsing +Resources: + + CodeUriWithS3LocationSpecifiedAsString: + Type: AWS::Serverless::Function + Properties: + Runtime: nodejs + CodeUri: s3://testbucket/testkey.zip + + CodeUriWithS3LocationSpecifiedAsObject: + Type: AWS::Serverless::Function + Properties: + Runtime: nodejs + CodeUri: + Bucket: testbucket + Key: testkey.zip + Version: 5 + + CodeUriWithString: + Type: AWS::Serverless::Function + Properties: + Runtime: nodejs + CodeUri: ./testfolder diff --git a/vendor/github.com/awslabs/goformation/test/yaml/codestar/java.yml b/vendor/github.com/awslabs/goformation/test/yaml/codestar/java.yml new file mode 100644 index 0000000000..98d1966c8e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/codestar/java.yml @@ -0,0 +1,41 @@ +AWSTemplateFormatVersion: 2010-09-09 +Transform: +- AWS::Serverless-2016-10-31 +- AWS::CodeStar + +Parameters: + ProjectId: + Type: String + Description: AWS CodeStar projectID used to associate new resources to team members + +Resources: + GetHelloWorld: + Type: AWS::Serverless::Function + Properties: + Handler: com.aws.codestar.projecttemplates.handler.HelloWorldHandler + CodeUri: target/ + Runtime: java8 + Role: + Fn::ImportValue: + !Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']] + Events: + GetEvent: + Type: Api + Properties: + Path: / + Method: get + + PostHelloWorld: + Type: AWS::Serverless::Function + Properties: + Handler: com.aws.codestar.projecttemplates.handler.HelloWorldHandler + Runtime: java8 + Role: + Fn::ImportValue: + !Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']] + Events: + PostEvent: + Type: Api + Properties: + Path: / + Method: post diff --git a/vendor/github.com/awslabs/goformation/test/yaml/codestar/nodejs.yml b/vendor/github.com/awslabs/goformation/test/yaml/codestar/nodejs.yml new file mode 100644 index 0000000000..f28f69f5d6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/codestar/nodejs.yml @@ -0,0 +1,25 @@ +AWSTemplateFormatVersion: 2010-09-09 +Transform: +- AWS::Serverless-2016-10-31 +- AWS::CodeStar + +Parameters: + ProjectId: + Type: String + Description: AWS CodeStar projectID used to associate new resources to team members + +Resources: + GetHelloWorld: + Type: AWS::Serverless::Function + Properties: + Handler: index.get + Runtime: nodejs4.3 + Role: + Fn::ImportValue: + !Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']] + Events: + GetEvent: + Type: Api + Properties: + Path: / + Method: get \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/codestar/python.yml b/vendor/github.com/awslabs/goformation/test/yaml/codestar/python.yml new file mode 100644 index 0000000000..97ae2a910d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/codestar/python.yml @@ -0,0 +1,30 @@ +AWSTemplateFormatVersion: 2010-09-09 +Transform: +- AWS::Serverless-2016-10-31 +- AWS::CodeStar + +Parameters: + ProjectId: + Type: String + Description: CodeStar projectId used to associate new resources to team members + +Resources: + HelloWorld: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: python2.7 + Role: + Fn::ImportValue: + !Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']] + Events: + GetEvent: + Type: Api + Properties: + Path: / + Method: get + PostEvent: + Type: Api + Properties: + Path: / + Method: post diff --git a/vendor/github.com/awslabs/goformation/test/yaml/output_section.yaml b/vendor/github.com/awslabs/goformation/test/yaml/output_section.yaml new file mode 100644 index 0000000000..91cb5cf105 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/output_section.yaml @@ -0,0 +1,14 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Simple CRUD webservice. State is stored in a SimpleTable (DynamoDB) resource. +Resources: + MyApi: + Type: AWS::Serverless::Api + Properties: + DefinitionUri: s3://bucket/key + StageName: prod + +Outputs: + ApiUrl: + Description: URL of API endpoint + Value: !Join ['', ['https://', !Ref "MyApi", '.execute-api.', !Ref 'AWS::Region', '.amazonaws.com/Prod']] \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/alexa_skill/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/alexa_skill/index.js new file mode 100644 index 0000000000..2b0de8b136 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/alexa_skill/index.js @@ -0,0 +1,33 @@ +'use strict'; +console.log('Loading hello world function'); + +exports.handler = function(event, context) { + var name = "World"; + var responseCode = 200; + console.log("request: " + JSON.stringify(event)); + if (event.queryStringParameters !== null && event.queryStringParameters !== undefined) { + if (event.queryStringParameters.name !== undefined && event.queryStringParameters.name !== null && event.queryStringParameters.name !== "") { + console.log("Received name: " + event.queryStringParameters.name); + name = event.queryStringParameters.name; + } + + if (event.queryStringParameters.httpStatus !== undefined && event.queryStringParameters.httpStatus !== null && event.queryStringParameters.httpStatus !== "") { + console.log("Received http status: " + event.queryStringParameters.httpStatus); + responseCode = event.queryStringParameters.httpStatus; + } + } + + var responseBody = { + message: "Hello " + name + "!", + input: event + }; + var response = { + statusCode: responseCode, + headers: { + "x-custom-header" : "my custom header value" + }, + body: JSON.stringify(responseBody) + }; + console.log("response: " + JSON.stringify(response)) + context.succeed(response); +}; diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/alexa_skill/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/alexa_skill/template.yaml new file mode 100644 index 0000000000..80ad8c0a11 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/alexa_skill/template.yaml @@ -0,0 +1,15 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Alexa Skill https://developer.amazon.com/alexa-skills-kit +Resources: + AlexaSkillFunction: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3:///alexa_skill.zip + Handler: index.handler + Runtime: nodejs4.3 + Events: + AlexaSkillEvent: + Type: AlexaSkill + Properties: + Whatever: whatever diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api-swagger-intrinsic.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api-swagger-intrinsic.yaml new file mode 100644 index 0000000000..429cb977e8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api-swagger-intrinsic.yaml @@ -0,0 +1,1038 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Swagger demo for Integration Requests + +Parameters: + + NotificationEmail: + Type: String + Description: Email address to subscribe to SNS topic and receive notifications from Notifier Workflow + + SlackToken: + Type: String + Description: Legacy Slack Token (xoxp-ywz) to send messages on channel + Default: None + +Resources: + + + SnsNotifierServiceRole: + Type: "AWS::IAM::Role" + Properties: + Path: "/" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + AssumeRolePolicyDocument: + Version: "2012-10-17" + Statement: + - + Sid: "AllowLambdaServiceToAssumeRole" + Effect: "Allow" + Action: + - "sts:AssumeRole" + Principal: + Service: + - "lambda.amazonaws.com" + Policies: + - + PolicyName: "PublishSnsTopic" + PolicyDocument: + Version: '2012-10-17' + Statement: + - + Effect: "Allow" + Action: + - "sns:Publish" + Resource: + - !Ref NotifierSNSTopic + - "*" # can't restrict on SMS number yet, so * + + + EmailNotifierServiceFunction: + Type: 'AWS::Serverless::Function' + Properties: + Handler: email_sns.lambda_handler + Runtime: python2.7 + CodeUri: ../code/email/ + Role: !GetAtt SnsNotifierServiceRole.Arn + Environment: + Variables: + NOTIFIER_TOPIC: !Ref NotifierSNSTopic + + + SmsNotifierServiceFunction: + Type: 'AWS::Serverless::Function' + Properties: + Handler: sms_sns.lambda_handler + Runtime: python2.7 + CodeUri: ../code/sms/ + Role: !GetAtt SnsNotifierServiceRole.Arn + Environment: + Variables: + NOTIFIER_TOPIC: !Ref NotifierSNSTopic + + # No need for extra permissions other than Basic Execution + # SAM takes care of creating basic IAM Role if none is provided + SlackNotifierServiceFunction: + Type: 'AWS::Serverless::Function' + Properties: + Handler: slack.lambda_handler + Runtime: python2.7 + CodeUri: ../code/slack.zip # Slack contains 3rd party libraries + Environment: + Variables: + SLACK_TOKEN: !Ref SlackToken + # IAM Role API Gateway will assume in order to call StepFunctions StartExecution API + ApiGatewayStepFunctionsRole: + Type: "AWS::IAM::Role" + Properties: + Path: "/" + AssumeRolePolicyDocument: + Version: "2012-10-17" + Statement: + - + Sid: "AllowApiGatewayServiceToAssumeRole" + Effect: "Allow" + Action: + - "sts:AssumeRole" + Principal: + Service: + - "apigateway.amazonaws.com" + Policies: + - + PolicyName: "CallStepFunctions" + PolicyDocument: + Version: '2012-10-17' + Statement: + - + Effect: "Allow" + Action: + - "states:StartExecution" + Resource: + - !Ref StepFunctionStateMachine + + AnotherRandomAPI: + Type: AWS::Serverless::Api + Properties: + StageName: prod + DefinitionBody: + swagger: "2.0" + info: + description: "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters" + version: 1.0.0 + title: Swagger Petstore YAML + termsOfService: "http://swagger.io/terms/" + contact: + email: "apiteam@swagger.io" + license: + name: Apache 2.0 + url: "http://www.apache.org/licenses/LICENSE-2.0.html" + basePath: /v2 + tags: + - name: pet + description: Everything about your Pets + externalDocs: + description: Find out more + url: "http://swagger.io" + - name: store + description: Operations about user + - name: user + description: Access to Petstore orders + externalDocs: + description: Find out more about our store + url: "http://swagger.io" + schemes: + - http + paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + x-swagger-router-controller: SampleController + description: "" + operationId: addPet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: false + schema: + $ref: "#/definitions/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - "write:pets" + - "read:pets" + put: + tags: + - pet + summary: Update an existing pet + description: "" + operationId: updatePet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: false + schema: + $ref: "#/definitions/Pet" + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma seperated strings + operationId: findPetsByStatus + consumes: + - application/xml + - application/json + - multipart/form-data + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: false + type: array + items: + type: string + collectionFormat: multi + default: available + enum: + - available + - pending + - sold + - name: testlong + in: query + description: Status values that need to be considered for filter + required: false + type: array + items: + type: long + collectionFormat: multi + default: available + enum: + - 1234567890123456 + - 345 + - 678 + responses: + "200": + description: successful operation + schema: + type: array + items: + $ref: "#/definitions/Pet" + "400": + description: Invalid status value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing." + operationId: findPetsByTags + produces: + - application/xml + - application/json + parameters: + - name: tags + in: query + description: Tags to filter by + required: false + type: array + items: + type: string + collectionFormat: multi + responses: + "200": + description: successful operation + schema: + type: array + items: + $ref: "#/definitions/Pet" + "400": + description: Invalid tag value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + "/pet/{petId}": + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + consumes: + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + type: integer + format: int64 + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/Pet" + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + - petstore_auth: + - "write:pets" + - "read:pets" + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: "" + operationId: updatePetWithForm + consumes: + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + type: string + - name: name + in: formData + description: Updated name of the pet + required: false + type: string + - name: status + in: formData + description: Updated status of the pet + required: false + type: string + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - "write:pets" + - "read:pets" + delete: + tags: + - pet + summary: Deletes a pet + description: "" + operationId: deletePet + consumes: + - multipart/form-data + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: api_key + in: header + description: "" + required: false + type: string + - name: petId + in: path + description: Pet id to delete + required: true + type: integer + format: int64 + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + "/pet/{petId}/uploadImage": + post: + tags: + - pet + summary: uploads an image + x-swagger-router-controller: SampleController + description: "" + operationId: uploadFile + consumes: + - multipart/form-data + produces: + - application/json + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + type: integer + format: int64 + - name: additionalMetadata + in: formData + description: Additional data to pass to server + required: false + type: string + - name: file + in: formData + description: file to upload + required: false + type: file + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/ApiResponse" + security: + - petstore_auth: + - "write:pets" + - "read:pets" + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + produces: + - application/json + parameters: [] + responses: + "200": + description: successful operation + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: "" + operationId: placeOrder + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: order placed for purchasing the pet + required: false + schema: + $ref: "#/definitions/Order" + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/Order" + "400": + description: Invalid Order + "/store/order/{orderId}": + get: + tags: + - store + summary: Find purchase order by ID + description: "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" + operationId: getOrderById + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + type: string + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/Order" + "400": + description: Invalid ID supplied + "404": + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + type: string + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Created user object + required: false + schema: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithArrayInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: false + schema: + type: array + items: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithListInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: false + schema: + type: array + items: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: "" + operationId: loginUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: query + description: The user name for login + required: false + type: string + - name: password + in: query + description: The password for login in clear text + required: false + type: string + responses: + "200": + description: successful operation + schema: + type: string + headers: + X-Rate-Limit: + type: integer + format: int32 + description: calls per hour allowed by the user + X-Expires-After: + type: string + format: date-time + description: date in UTC when toekn expires + "400": + description: Invalid username/password supplied + x-amazon-apigateway-integration: + uri: + Fn::GetAtt: [ "SmsNotifierServiceFunction", "Arn" ] + httpMethod: POST + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: "" + operationId: logoutUser + produces: + - application/xml + - application/json + parameters: [] + responses: + default: + description: successful operation + x-amazon-apigateway-integration: + uri: + Fn::Sub: + - "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${FunctionName}/invocations" + - {"FunctionName": !Ref EmailNotifierServiceFunction } + httpMethod: POST + "/user/{username}": + get: + tags: + - user + summary: Get user by user name + description: "" + operationId: getUserByName + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: "The name that needs to be fetched. Use user1 for testing. " + required: true + type: string + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/User" + "400": + description: Invalid username supplied + "404": + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + type: string + - in: body + name: body + description: Updated user object + required: false + schema: + $ref: "#/definitions/User" + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + type: string + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + securityDefinitions: + petstore_auth: + type: oauth2 + authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" + flow: implicit + scopes: + "write:pets": modify pets in your account + "read:pets": read your pets + api_key: + type: apiKey + name: api_key + in: header + definitions: + Order: + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + xml: + name: Order + Category: + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Category + User: + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: "#/definitions/Category" + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: "#/definitions/Tag" + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + xml: + name: "##default" + externalDocs: + description: Find out more about Swagger + url: "http://swagger.io" + StepFunctionsAPI: + Type: AWS::Serverless::Api + Properties: + StageName: dev + DefinitionBody: + swagger: "2.0" + basePath: /prod + info: + title: AwsSamExample + schemes: + - https + paths: + /: + x-amazon-apigateway-any-method: + security: + - test-authorizer: [] + produces: + - application/json + responses: + 200: + description: 200 response + schema: + $ref: "#/definitions/Empty" + x-amazon-apigateway-integration: + responses: + default: + statusCode: 200 + # NOTE: Replace <> and <> fields + uri: arn:aws:apigateway:<>:lambda:path/2015-03-31/functions/arn:aws:lambda:<>:<>:function:${stageVariables.LambdaFunctionName}/invocations + + passthroughBehavior: when_no_match + httpMethod: POST + type: aws_proxy + options: + consumes: + - application/json + produces: + - application/json + responses: + 200: + description: 200 response + schema: + $ref: "#/definitions/Empty" + headers: + Access-Control-Allow-Origin: + type: string + Access-Control-Allow-Methods: + type: string + Access-Control-Allow-Headers: + type: string + x-amazon-apigateway-integration: + type: aws + uri: arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:012345678901:function:HelloWorld/invocations + httpMethod: POST + credentials: arn:aws:iam::012345678901:role/apigateway-invoke-lambda-exec-role + requestTemplates: + application/json: '#set ($root=$input.path(''$'')) { "stage": "$root.name", "user-id": + "$root.key" }' + application/xml: "#set ($root=$input.path('$')) $root.name " + requestParameters: + integration.request.path.stage: method.request.querystring.version + integration.request.querystring.provider: method.request.querystring.vendor + cacheNamespace: cache namespace + cacheKeyParameters: [] + responses: + '302': + statusCode: '302' + responseParameters: + method.response.header.Location: integration.response.body.redirect.url + 2\d{2}: + statusCode: '200' + responseParameters: + method.response.header.requestId: integration.response.header.cid + responseTemplates: + application/json: '#set ($root=$input.path(''$'')) { "stage": "$root.name", + "user-id": "$root.key" }' + application/xml: "#set ($root=$input.path('$')) $root.name " + default: + statusCode: '400' + responseParameters: + method.response.header.test-method-response-header: "'static value'" + x-amazon-apigateway-integration: + uri: !Sub + - "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${EmailNotifierServiceFunction}${Test}/invocations" + - { "Test": "ABCD", "OtherTest": !Ref something } + httpMethod: POST + StepFunctionsServiceRole: + Type: "AWS::IAM::Role" + Properties: + Path: "/" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/AWSStepFunctionsFullAccess" + AssumeRolePolicyDocument: + Version: "2012-10-17" + Statement: + - + Sid: "AllowStepFunctionsServiceToAssumeRole" + Effect: "Allow" + Action: + - "sts:AssumeRole" + Principal: + Service: + - !Sub "states.${AWS::Region}.amazonaws.com" + Policies: + - + PolicyName: "CallLambdaFunctions" + PolicyDocument: + Version: '2012-10-17' + Statement: + - + Effect: "Allow" + Action: + - "lambda:InvokeFunction" + Resource: + - !Sub "${SlackNotifierServiceFunction.Arn}" + - !Sub "${EmailNotifierServiceFunction.Arn}" + - !Sub "${SmsNotifierServiceFunction.Arn}" + + StepFunctionStateMachine: + Type: "AWS::StepFunctions::StateMachine" + Properties: + DefinitionString: !Sub | + { + "Comment": "Demo for API GW->SFN", + "StartAt": "NotifierState", + "States": { + "NotifierState": { + "Type" : "Choice", + "Choices": [ + { + "Variable": "$.notifier", + "StringEquals": "Email", + "Next": "EmailNotifier" + }, + { + "Variable": "$.notifier", + "StringEquals": "Sms", + "Next": "SmsNotifier" + }, + { + "Variable": "$.notifier", + "StringEquals": "Slack", + "Next": "SlackNotifier" + }, + { + "Variable": "$.notify", + "StringEquals": "Twilio", + "Next": "NotImplementedYet" + } + ], + "Default": "IgnoreNotification" + }, + "IgnoreNotification": { + "Type": "Pass", + "Next": "SayHi" + }, + "NotImplementedYet": { + "Type": "Fail", + "Cause": "Feature not implemented yet!" + }, + "EmailNotifier": { + "Type": "Task", + "Resource": "${EmailNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SlackNotifier": { + "Type": "Task", + "Resource": "${SlackNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SmsNotifier": { + "Type": "Task", + "Resource": "${SmsNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SayHi": { + "Type": "Pass", + "Result": "Hi!", + "End": true + } + } + } + RoleArn: !GetAtt StepFunctionsServiceRole.Arn + NotifierSNSTopic: + Type: AWS::SNS::Topic + Properties: + Subscription: + - Endpoint: !Ref NotificationEmail + Protocol: email +Outputs: + NotifyUrl: + Description: Notify Workflow URL + Value: !Sub "https://${StepFunctionsAPI}.execute-api.${AWS::Region}.amazonaws.com/dev/notify" + + StepFunctionsStateMachine: + Description: Step Functions State Machine ARN + Value: !Ref StepFunctionStateMachine \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api-swagger-plain.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api-swagger-plain.yaml new file mode 100644 index 0000000000..cc7f499ce4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api-swagger-plain.yaml @@ -0,0 +1,1111 @@ +AWSTemplateFormatVersion: "2010-09-09" +Description: "Swagger demo for Integration Requests" +Outputs: + NotifyUrl: + Description: "Notify Workflow URL" + Value: "https://${StepFunctionsAPI}.execute-api.${AWS::Region}.amazonaws.com/dev/notify" + StepFunctionsStateMachine: + Description: "Step Functions State Machine ARN" + Value: StepFunctionStateMachine +Parameters: + NotificationEmail: + Description: "Email address to subscribe to SNS topic and receive notifications from Notifier Workflow" + Type: String + SlackToken: + Default: None + Description: "Legacy Slack Token (xoxp-ywz) to send messages on channel" + Type: String +Resources: + AnotherRandomAPI: + Properties: + DefinitionBody: + basePath: /v2 + definitions: + ApiResponse: + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + xml: + name: "##default" + Category: + properties: + id: + format: int64 + type: integer + name: + type: string + xml: + name: Category + Order: + properties: + complete: + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: "Order Status" + enum: + - placed + - approved + - delivered + type: string + xml: + name: Order + Pet: + properties: + category: + $ref: "#/definitions/Category" + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: "pet status in the store" + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: "#/definitions/Tag" + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + xml: + name: Pet + Tag: + properties: + id: + format: int64 + type: integer + name: + type: string + xml: + name: Tag + User: + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: "User Status" + format: int32 + type: integer + username: + type: string + xml: + name: User + externalDocs: + description: "Find out more about Swagger" + url: "http://swagger.io" + info: + contact: + email: apiteam@swagger.io + description: "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters" + license: + name: "Apache 2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0.html" + termsOfService: "http://swagger.io/terms/" + title: "Swagger Petstore YAML" + version: "1.0.0" + paths: + /pet: + post: + consumes: + - application/json + - application/xml + description: "" + operationId: addPet + parameters: + - + description: "Pet object that needs to be added to the store" + in: body + name: body + required: false + schema: + $ref: "#/definitions/Pet" + produces: + - application/xml + - application/json + responses: + "405": + description: "Invalid input" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Add a new pet to the store" + tags: + - pet + x-swagger-router-controller: SampleController + put: + consumes: + - application/json + - application/xml + description: "" + operationId: updatePet + parameters: + - + description: "Pet object that needs to be added to the store" + in: body + name: body + required: false + schema: + $ref: "#/definitions/Pet" + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid ID supplied" + "404": + description: "Pet not found" + "405": + description: "Validation exception" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Update an existing pet" + tags: + - pet + /pet/findByStatus: + get: + consumes: + - application/xml + - application/json + - multipart/form-data + - application/x-www-form-urlencoded + description: "Multiple status values can be provided with comma seperated strings" + operationId: findPetsByStatus + parameters: + - + collectionFormat: multi + default: available + description: "Status values that need to be considered for filter" + enum: + - available + - pending + - sold + in: query + items: + type: string + name: status + required: false + type: array + - + collectionFormat: multi + default: available + description: "Status values that need to be considered for filter" + enum: + - 1234567890123456 + - 345 + - 678 + in: query + items: + type: long + name: testlong + required: false + type: array + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + items: + $ref: "#/definitions/Pet" + type: array + "400": + description: "Invalid status value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Finds Pets by status" + tags: + - pet + /pet/findByTags: + get: + description: "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - + collectionFormat: multi + description: "Tags to filter by" + in: query + items: + type: string + name: tags + required: false + type: array + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + items: + $ref: "#/definitions/Pet" + type: array + "400": + description: "Invalid tag value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Finds Pets by tags" + tags: + - pet + ? "/pet/{petId}" + : + delete: + consumes: + - multipart/form-data + - application/x-www-form-urlencoded + description: "" + operationId: deletePet + parameters: + - + description: "" + in: header + name: api_key + required: false + type: string + - + description: "Pet id to delete" + format: int64 + in: path + name: petId + required: true + type: integer + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid pet value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Deletes a pet" + tags: + - pet + get: + consumes: + - application/x-www-form-urlencoded + description: "Returns a single pet" + operationId: getPetById + parameters: + - + description: "ID of pet to return" + format: int64 + in: path + name: petId + required: true + type: integer + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/Pet" + "400": + description: "Invalid ID supplied" + "404": + description: "Pet not found" + security: + - + api_key: [] + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Find pet by ID" + tags: + - pet + post: + consumes: + - application/x-www-form-urlencoded + description: "" + operationId: updatePetWithForm + parameters: + - + description: "ID of pet that needs to be updated" + in: path + name: petId + required: true + type: string + - + description: "Updated name of the pet" + in: formData + name: name + required: false + type: string + - + description: "Updated status of the pet" + in: formData + name: status + required: false + type: string + produces: + - application/xml + - application/json + responses: + "405": + description: "Invalid input" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "Updates a pet in the store with form data" + tags: + - pet + ? "/pet/{petId}/uploadImage" + : + post: + consumes: + - multipart/form-data + description: "" + operationId: uploadFile + parameters: + - + description: "ID of pet to update" + format: int64 + in: path + name: petId + required: true + type: integer + - + description: "Additional data to pass to server" + in: formData + name: additionalMetadata + required: false + type: string + - + description: "file to upload" + in: formData + name: file + required: false + type: file + produces: + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/ApiResponse" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + summary: "uploads an image" + tags: + - pet + x-swagger-router-controller: SampleController + /store/inventory: + get: + description: "Returns a map of status codes to quantities" + operationId: getInventory + parameters: [] + produces: + - application/json + responses: + "200": + description: "successful operation" + schema: + additionalProperties: + format: int32 + type: integer + type: object + security: + - + api_key: [] + summary: "Returns pet inventories by status" + tags: + - store + /store/order: + post: + description: "" + operationId: placeOrder + parameters: + - + description: "order placed for purchasing the pet" + in: body + name: body + required: false + schema: + $ref: "#/definitions/Order" + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/Order" + "400": + description: "Invalid Order" + summary: "Place an order for a pet" + tags: + - store + ? "/store/order/{orderId}" + : + delete: + description: "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors" + operationId: deleteOrder + parameters: + - + description: "ID of the order that needs to be deleted" + in: path + name: orderId + required: true + type: string + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid ID supplied" + "404": + description: "Order not found" + summary: "Delete purchase order by ID" + tags: + - store + get: + description: "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" + operationId: getOrderById + parameters: + - + description: "ID of pet that needs to be fetched" + in: path + name: orderId + required: true + type: string + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/Order" + "400": + description: "Invalid ID supplied" + "404": + description: "Order not found" + summary: "Find purchase order by ID" + tags: + - store + /user: + post: + description: "This can only be done by the logged in user." + operationId: createUser + parameters: + - + description: "Created user object" + in: body + name: body + required: false + schema: + $ref: "#/definitions/User" + produces: + - application/xml + - application/json + responses: + default: + description: "successful operation" + summary: "Create user" + tags: + - user + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + parameters: + - + description: "List of user object" + in: body + name: body + required: false + schema: + items: + $ref: "#/definitions/User" + type: array + produces: + - application/xml + - application/json + responses: + default: + description: "successful operation" + summary: "Creates list of users with given input array" + tags: + - user + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + parameters: + - + description: "List of user object" + in: body + name: body + required: false + schema: + items: + $ref: "#/definitions/User" + type: array + produces: + - application/xml + - application/json + responses: + default: + description: "successful operation" + summary: "Creates list of users with given input array" + tags: + - user + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - + description: "The user name for login" + in: query + name: username + required: false + type: string + - + description: "The password for login in clear text" + in: query + name: password + required: false + type: string + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + headers: + X-Expires-After: + description: "date in UTC when toekn expires" + format: date-time + type: string + X-Rate-Limit: + description: "calls per hour allowed by the user" + format: int32 + type: integer + schema: + type: string + "400": + description: "Invalid username/password supplied" + summary: "Logs user into the system" + tags: + - user + /user/logout: + get: + description: "" + operationId: logoutUser + parameters: [] + produces: + - application/xml + - application/json + responses: + default: + description: "successful operation" + summary: "Logs out current logged in user session" + tags: + - user + ? "/user/{username}" + : + delete: + description: "This can only be done by the logged in user." + operationId: deleteUser + parameters: + - + description: "The name that needs to be deleted" + in: path + name: username + required: true + type: string + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid username supplied" + "404": + description: "User not found" + summary: "Delete user" + tags: + - user + get: + description: "" + operationId: getUserByName + parameters: + - + description: "The name that needs to be fetched. Use user1 for testing. " + in: path + name: username + required: true + type: string + produces: + - application/xml + - application/json + responses: + "200": + description: "successful operation" + schema: + $ref: "#/definitions/User" + "400": + description: "Invalid username supplied" + "404": + description: "User not found" + summary: "Get user by user name" + tags: + - user + put: + description: "This can only be done by the logged in user." + operationId: updateUser + parameters: + - + description: "name that need to be deleted" + in: path + name: username + required: true + type: string + - + description: "Updated user object" + in: body + name: body + required: false + schema: + $ref: "#/definitions/User" + produces: + - application/xml + - application/json + responses: + "400": + description: "Invalid user supplied" + "404": + description: "User not found" + summary: "Updated user" + tags: + - user + schemes: + - http + securityDefinitions: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" + flow: implicit + scopes: + ? "read:pets" + : "read your pets" + ? "write:pets" + : "modify pets in your account" + type: oauth2 + swagger: "2.0" + tags: + - + description: "Everything about your Pets" + externalDocs: + description: "Find out more" + url: "http://swagger.io" + name: pet + - + description: "Operations about user" + name: store + - + description: "Access to Petstore orders" + externalDocs: + description: "Find out more about our store" + url: "http://swagger.io" + name: user + StageName: prod + Type: "AWS::Serverless::Api" + ApiGatewayStepFunctionsRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - + Action: + - "sts:AssumeRole" + Effect: Allow + Principal: + Service: + - apigateway.amazonaws.com + Sid: AllowApiGatewayServiceToAssumeRole + Version: "2012-10-17" + Path: / + Policies: + - + PolicyDocument: + Statement: + - + Action: + - "states:StartExecution" + Effect: Allow + Resource: + - StepFunctionStateMachine + Version: "2012-10-17" + PolicyName: CallStepFunctions + Type: "AWS::IAM::Role" + EmailNotifierServiceFunction: + Properties: + CodeUri: ../code/email/ + Environment: + Variables: + NOTIFIER_TOPIC: NotifierSNSTopic + Handler: email_sns.lambda_handler + Role: SnsNotifierServiceRole.Arn + Runtime: python2.7 + Type: "AWS::Serverless::Function" + NotifierSNSTopic: + Properties: + Subscription: + - + Endpoint: NotificationEmail + Protocol: email + Type: "AWS::SNS::Topic" + SlackNotifierServiceFunction: + Properties: + CodeUri: ../code/slack.zip + Environment: + Variables: + SLACK_TOKEN: SlackToken + Handler: slack.lambda_handler + Runtime: python2.7 + Type: "AWS::Serverless::Function" + SmsNotifierServiceFunction: + Properties: + CodeUri: ../code/sms/ + Environment: + Variables: + NOTIFIER_TOPIC: NotifierSNSTopic + Handler: sms_sns.lambda_handler + Role: SnsNotifierServiceRole.Arn + Runtime: python2.7 + Type: "AWS::Serverless::Function" + SnsNotifierServiceRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - + Action: + - "sts:AssumeRole" + Effect: Allow + Principal: + Service: + - lambda.amazonaws.com + Sid: AllowLambdaServiceToAssumeRole + Version: "2012-10-17" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + Path: / + Policies: + - + PolicyDocument: + Statement: + - + Action: + - "sns:Publish" + Effect: Allow + Resource: + - NotifierSNSTopic + - "*" + Version: "2012-10-17" + PolicyName: PublishSnsTopic + Type: "AWS::IAM::Role" + StepFunctionStateMachine: + Properties: + DefinitionString: | + { + "Comment": "Demo for API GW->SFN", + "StartAt": "NotifierState", + "States": { + "NotifierState": { + "Type" : "Choice", + "Choices": [ + { + "Variable": "$.notifier", + "StringEquals": "Email", + "Next": "EmailNotifier" + }, + { + "Variable": "$.notifier", + "StringEquals": "Sms", + "Next": "SmsNotifier" + }, + { + "Variable": "$.notifier", + "StringEquals": "Slack", + "Next": "SlackNotifier" + }, + { + "Variable": "$.notify", + "StringEquals": "Twilio", + "Next": "NotImplementedYet" + } + ], + "Default": "IgnoreNotification" + }, + "IgnoreNotification": { + "Type": "Pass", + "Next": "SayHi" + }, + "NotImplementedYet": { + "Type": "Fail", + "Cause": "Feature not implemented yet!" + }, + "EmailNotifier": { + "Type": "Task", + "Resource": "${EmailNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SlackNotifier": { + "Type": "Task", + "Resource": "${SlackNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SmsNotifier": { + "Type": "Task", + "Resource": "${SmsNotifierServiceFunction.Arn}", + "Next": "SayHi" + }, + "SayHi": { + "Type": "Pass", + "Result": "Hi!", + "End": true + } + } + } + RoleArn: StepFunctionsServiceRole.Arn + Type: "AWS::StepFunctions::StateMachine" + StepFunctionsAPI: + Properties: + DefinitionBody: + basePath: /prod + definitions: + Empty: + title: "Empty Schema" + type: object + info: + title: AwsSamExample + paths: + /: + options: + consumes: + - application/json + produces: + - application/json + responses: + 200: + description: "200 response" + headers: + Access-Control-Allow-Headers: + type: string + Access-Control-Allow-Methods: + type: string + Access-Control-Allow-Origin: + type: string + schema: + $ref: "#/definitions/Empty" + x-amazon-apigateway-integration: + cacheKeyParameters: [] + cacheNamespace: "cache namespace" + credentials: "arn:aws:iam::012345678901:role/apigateway-invoke-lambda-exec-role" + httpMethod: POST + requestParameters: + integration.request.path.stage: method.request.querystring.version + integration.request.querystring.provider: method.request.querystring.vendor + requestTemplates: + application/json: "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }" + application/xml: "#set ($root=$input.path('$')) $root.name " + responses: + "2\\d{2}": + responseParameters: + method.response.header.requestId: integration.response.header.cid + responseTemplates: + application/json: "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }" + application/xml: "#set ($root=$input.path('$')) $root.name " + statusCode: "200" + "302": + responseParameters: + method.response.header.Location: integration.response.body.redirect.url + statusCode: "302" + default: + responseParameters: + method.response.header.test-method-response-header: "'static value'" + statusCode: "400" + type: aws + uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:012345678901:function:HelloWorld/invocations" + x-amazon-apigateway-any-method: + produces: + - application/json + responses: + 200: + description: "200 response" + schema: + $ref: "#/definitions/Empty" + security: + - + test-authorizer: [] + x-amazon-apigateway-integration: + httpMethod: POST + passthroughBehavior: when_no_match + responses: + default: + statusCode: 200 + type: aws_proxy + uri: EmailNotifierServiceFunction.Arn + "/{proxy+}": + options: + consumes: + - application/json + produces: + - application/json + responses: + 200: + description: "200 response" + headers: + Access-Control-Allow-Headers: + type: string + Access-Control-Allow-Methods: + type: string + Access-Control-Allow-Origin: + type: string + schema: + $ref: "#/definitions/Empty" + x-amazon-apigateway-integration: + passthroughBehavior: when_no_match + requestTemplates: + application/json: "{\"statusCode\": 200}" + responses: + default: + responseParameters: + method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'" + method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'" + method.response.header.Access-Control-Allow-Origin: "'*'" + statusCode: 200 + type: mock + x-amazon-apigateway-any-method: + parameters: + - + in: path + name: proxy + required: true + type: string + produces: + - application/json + responses: {} + x-amazon-apigateway-auth: + type: aws_iam + x-amazon-apigateway-integration: + httpMethod: POST + type: aws_proxy + uri: "arn:aws:apigateway:<>:lambda:path/2015-03-31/functions/arn:aws:lambda:<>:<>:function:${stageVariables.LambdaFunctionName}/invocations" + schemes: + - https + securityDefinitions: + test-authorizer: + in: header + name: Authorization + type: apiKey + x-amazon-apigateway-authorizer: + authorizerCredentials: "arn:aws:iam::account-id:role" + authorizerResultTtlInSeconds: 60 + authorizerUri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:account-id:function:function-name/invocations" + identityValidationExpression: "^x-[a-z]+" + type: token + x-amazon-apigateway-authtype: oauth2 + swagger: "2.0" + StageName: dev + Type: "AWS::Serverless::Api" + StepFunctionsServiceRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - + Action: + - "sts:AssumeRole" + Effect: Allow + Principal: + Service: + - "states.${AWS::Region}.amazonaws.com" + Sid: AllowStepFunctionsServiceToAssumeRole + Version: "2012-10-17" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/AWSStepFunctionsFullAccess" + Path: / + Policies: + - + PolicyDocument: + Statement: + - + Action: + - "lambda:InvokeFunction" + Effect: Allow + Resource: + - "${SlackNotifierServiceFunction.Arn}" + - "${EmailNotifierServiceFunction.Arn}" + - "${SmsNotifierServiceFunction.Arn}" + Version: "2012-10-17" + PolicyName: CallLambdaFunctions + Type: "AWS::IAM::Role" +Transform: "AWS::Serverless-2016-10-31" diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_backend/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_backend/index.js new file mode 100644 index 0000000000..5420b07b56 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_backend/index.js @@ -0,0 +1,87 @@ +'use strict'; + + +const AWS = require('aws-sdk'); +const dynamo = new AWS.DynamoDB.DocumentClient(); + +const tableName = process.env.TABLE_NAME; + +const createResponse = (statusCode, body) => { + + return { + statusCode: statusCode, + body: body + } +}; + +exports.get = (event, context, callback) => { + + let params = { + TableName: tableName, + Key: { + id: event.pathParameters.resourceId + } + }; + + let dbGet = (params) => { return dynamo.get(params).promise() }; + + dbGet(params).then( (data) => { + if (!data.Item) { + callback(null, createResponse(404, "ITEM NOT FOUND")); + return; + } + console.log(`RETRIEVED ITEM SUCCESSFULLY WITH doc = ${data.Item.doc}`); + callback(null, createResponse(200, data.Item.doc)); + }).catch( (err) => { + console.log(`GET ITEM FAILED FOR doc = ${data.Item.doc}, WITH ERROR: ${err}`); + callback(null, createResponse(500, err)); + }); +}; + +exports.put = (event, context, callback) => { + + let item = { + id: event.pathParameters.resourceId, + doc: event.body + }; + + let params = { + TableName: tableName, + Item: item + }; + + let dbPut = (params) => { return dynamo.put(params).promise() }; + + dbPut(params).then( (data) => { + console.log(`PUT ITEM SUCCEEDED WITH doc = ${item.doc}`); + callback(null, createResponse(200, null)); + }).catch( (err) => { + console.log(`PUT ITEM FAILED FOR doc = ${item.doc}, WITH ERROR: ${err}`); + callback(null, createResponse(500, err)); + }); +}; + +exports.delete = (event, context, callback) => { + + let params = { + TableName: tableName, + Key: { + id: event.pathParameters.resourceId + }, + ReturnValues: 'ALL_OLD' + }; + + let dbDelete = (params) => { return dynamo.delete(params).promise() }; + + dbDelete(params).then( (data) => { + if (!data.Attributes) { + callback(null, createResponse(404, "ITEM NOT FOUND FOR DELETION")); + return; + } + console.log(`DELETED ITEM SUCCESSFULLY WITH id = ${event.pathParameters.resourceId}`); + callback(null, createResponse(200, null)); + }).catch( (err) => { + console.log(`DELETE ITEM FAILED FOR id = ${event.pathParameters.resourceId}, WITH ERROR: ${err}`); + callback(null, createResponse(500, err)); + }); +}; diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_backend/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_backend/template.yaml new file mode 100644 index 0000000000..5b2710a255 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_backend/template.yaml @@ -0,0 +1,54 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Simple CRUD webservice. State is stored in a SimpleTable (DynamoDB) resource. +Resources: + GetFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.get + Runtime: nodejs4.3 + CodeUri: s3:///api_backend.zip + Policies: AmazonDynamoDBReadOnlyAccess + Environment: + Variables: + TABLE_NAME: !Ref Table + Events: + GetResource: + Type: Api + Properties: + Path: /resource/{resourceId} + Method: get + + PutFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.put + Runtime: nodejs4.3 + CodeUri: s3:///api_backend.zip + Policies: AmazonDynamoDBFullAccess + Environment: + Variables: + TABLE_NAME: !Ref Table + Events: + PutResource: + Type: Api + Properties: + Path: /resource/{resourceId} + Method: put + + DeleteFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.delete + Runtime: nodejs4.3 + CodeUri: s3:///api_backend.zip + Policies: AmazonDynamoDBFullAccess + Environment: + Variables: + TABLE_NAME: !Ref Table + Events: + DeleteResource: + Type: Api + Properties: + Path: /resource/{resourceId} + Method: delete \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/index.js new file mode 100644 index 0000000000..03d56b3116 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/index.js @@ -0,0 +1,8 @@ +exports.handler = function(event, context, callback) { + + callback(null, { + statusCode: '200', + body: "Hello world" + }); + +} diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/swagger.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/swagger.yaml new file mode 100644 index 0000000000..70546630a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/swagger.yaml @@ -0,0 +1,105 @@ +--- +swagger: 2.0 +basePath: /prod +info: + title: AwsSamExample +schemes: +- https +paths: + /: + x-amazon-apigateway-any-method: + produces: + - application/json + responses: + 200: + description: 200 response + schema: + $ref: "#/definitions/Empty" + x-amazon-apigateway-integration: + responses: + default: + statusCode: 200 + # NOTE: Replace <> and <> fields + uri: arn:aws:apigateway:<>:lambda:path/2015-03-31/functions/arn:aws:lambda:<>:<>:function:${stageVariables.LambdaFunctionName}/invocations + + passthroughBehavior: when_no_match + httpMethod: POST + type: aws_proxy + options: + consumes: + - application/json + produces: + - application/json + responses: + 200: + description: 200 response + schema: + $ref: "#/definitions/Empty" + headers: + Access-Control-Allow-Origin: + type: string + Access-Control-Allow-Methods: + type: string + Access-Control-Allow-Headers: + type: string + x-amazon-apigateway-integration: + responses: + default: + statusCode: 200 + responseParameters: + method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'" + method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'" + method.response.header.Access-Control-Allow-Origin: "'*'" + passthroughBehavior: when_no_match + requestTemplates: + application/json: "{\"statusCode\": 200}" + type: mock + /{proxy+}: + x-amazon-apigateway-any-method: + x-amazon-apigateway-auth: + type: aws_iam + produces: + - application/json + parameters: + - name: proxy + in: path + required: true + type: string + responses: {} + x-amazon-apigateway-integration: + uri: arn:aws:apigateway:<>:lambda:path/2015-03-31/functions/arn:aws:lambda:<>:<>:function:${stageVariables.LambdaFunctionName}/invocations + httpMethod: POST + type: aws_proxy + options: + consumes: + - application/json + produces: + - application/json + responses: + 200: + description: 200 response + schema: + $ref: "#/definitions/Empty" + headers: + Access-Control-Allow-Origin: + type: string + Access-Control-Allow-Methods: + type: string + Access-Control-Allow-Headers: + type: string + x-amazon-apigateway-integration: + responses: + default: + statusCode: 200 + responseParameters: + method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'" + method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'" + method.response.header.Access-Control-Allow-Origin: "'*'" + passthroughBehavior: when_no_match + requestTemplates: + application/json: "{\"statusCode\": 200}" + type: mock +definitions: + Empty: + type: object + title: Empty Schema diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/template.yaml new file mode 100644 index 0000000000..d7e8450561 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/api_swagger_cors/template.yaml @@ -0,0 +1,46 @@ +--- +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: AWS SAM template with API defined in an external Swagger file along with Lambda integrations and CORS configurations +Resources: + ApiGatewayApi: + Type: AWS::Serverless::Api + Properties: + DefinitionUri: s3:///swagger.yaml + StageName: Prod + Variables: + # NOTE: Before using this template, replace the <> and <> fields + # in Lambda integration URI in the swagger file to region and accountId + # you are deploying to + LambdaFunctionName: !Ref LambdaFunction + + LambdaFunction: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3:///api_swagger_cors.zip + Handler: index.handler + Runtime: nodejs4.3 + Events: + ProxyApiRoot: + Type: Api + Properties: + RestApiId: !Ref ApiGatewayApi + Path: / + Method: ANY + ProxyApiGreedy: + Type: Api + Properties: + RestApiId: !Ref ApiGatewayApi + Path: /{proxy+} + Method: ANY + +Outputs: + ApiUrl: + Description: URL of your API endpoint + Value: !Join + - '' + - - https:// + - !Ref ApiGatewayApi + - '.execute-api.' + - !Ref 'AWS::Region' + - '.amazonaws.com/Prod' diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/codestar-node4.3.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/codestar-node4.3.yaml new file mode 100644 index 0000000000..f28f69f5d6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/codestar-node4.3.yaml @@ -0,0 +1,25 @@ +AWSTemplateFormatVersion: 2010-09-09 +Transform: +- AWS::Serverless-2016-10-31 +- AWS::CodeStar + +Parameters: + ProjectId: + Type: String + Description: AWS CodeStar projectID used to associate new resources to team members + +Resources: + GetHelloWorld: + Type: AWS::Serverless::Function + Properties: + Handler: index.get + Runtime: nodejs4.3 + Role: + Fn::ImportValue: + !Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']] + Events: + GetEvent: + Type: Api + Properties: + Path: / + Method: get \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/README.MD b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/README.MD new file mode 100644 index 0000000000..f439e69bd6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/README.MD @@ -0,0 +1,48 @@ +### Encryption/Decryption Proxy + +This template creates the following resources: + +* 2 Lambda functions (Encryption, Decryption) + - SAM takes care of creating 2 stages API Gateway {Stage,Prod} that sits on top +* IAM Role for each function +* KMS Key and KMS Decrypt/Encrypt permissions for each IAM Role separately + - KMS Key ID is then passed to Encryption Lambda via Env vars + + +#### Encrypt Action + +* Consumes up to 4KB of data (string, json blob, etc.) +* Returns encrypted data via JSON blob as follows + +```javascript +{ + "data": "base64_encrypted_blob" +} +``` + +**Encrypting data via cURL** + +```bash +encryptURL=$(aws cloudformation describe-stacks --stack-name encryption-proxy --query 'Stacks[].Outputs[?OutputKey==`EncryptURL`].OutputValue' --output text) + +curl -H 'Content-Type: application/json' -X POST -d 'Here it is my super secret data...' ${encryptURL} +``` + +#### Decrypt Action + +* Consumes JSON blob received out of Encryption Action +* Returns decrypted data via JSON blob as follows + +```javascript +{ + "data": "decrypted_data" +} +``` + +**Decrypting data via cURL** + +```bash +decryptURL=$(aws cloudformation describe-stacks --stack-name encryption-proxy --query 'Stacks[].Outputs[?OutputKey==`DecryptURL`].OutputValue' --output text) + +curl -H 'Content-Type: application/json' -X POST -d '{ "data": "AQECAHjgf/RDFTAO0+ief3VXaJRnnKbyaaEsVhkmYxTcbiNhcgAAAHIwcAYJKoZIhvcNAQcGoGMw\nYQIBADBcBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDBX7iv8CwG1gr2Hc4wIBEIAvS1cXraMW\n3PU96z4AACGj7Wuo007HwWjtK/quSi3FKyYFvkJ10YhDOEvzxOD7Ntw=\n" }' ${decryptURL} +``` diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/decryption.py b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/decryption.py new file mode 100644 index 0000000000..ac04a86fa5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/decryption.py @@ -0,0 +1,49 @@ +import boto3 +import json +import base64 + +kms = boto3.client('kms') +bad_request = { + 'statusCode': 400, + 'headers': { + 'Content-Type': 'application/json' + }, + 'body': json.dumps({'error': 'Invalid argument'}) +} + + +def decrypt(message): + '''decrypt leverages KMS decrypt and base64-encode decrypted blob + + More info on KMS decrypt API: + https://docs.aws.amazon.com/kms/latest/APIReference/API_decrypt.html + ''' + try: + ret = kms.decrypt( + CiphertextBlob=base64.decodestring(message)) + decrypted_data = ret.get('Plaintext') + except Exception as e: + # returns http 500 back to user and log error details in Cloudwatch Logs + raise Exception("Unable to decrypt data: ", e) + + return decrypted_data + + +def post(event, context): + + try: + payload = json.loads(event['body']) + message = payload['data'] + except (KeyError, TypeError, ValueError): + return bad_request + + decrypted_message = decrypt(message) + response = {'data': decrypted_message} + + return { + 'statusCode': 200, + 'headers': { + 'Content-Type': 'application/json' + }, + 'body': json.dumps(response) + } diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/encryption.py b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/encryption.py new file mode 100644 index 0000000000..72598f3c47 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/encryption.py @@ -0,0 +1,53 @@ +import boto3 +import json +import base64 +import os + +kms = boto3.client('kms') +bad_request = { + 'statusCode': 400, + 'headers': { + 'Content-Type': 'application/json' + }, + 'body': json.dumps({'error': 'Invalid argument'}) +} + + +def encrypt(key, message): + '''encrypt leverages KMS encrypt and base64-encode encrypted blob + + More info on KMS encrypt API: + https://docs.aws.amazon.com/kms/latest/APIReference/API_encrypt.html + ''' + try: + ret = kms.encrypt(KeyId=key, Plaintext=message) + encrypted_data = base64.encodestring(ret.get('CiphertextBlob')) + except Exception as e: + # returns http 500 back to user and log error details in Cloudwatch Logs + raise Exception("Unable to encrypt data: ", e) + + return encrypted_data + + +def post(event, context): + + try: + key_id = os.environ['keyId'] + message = event['body'] + if message is None: + raise ValueError + except KeyError: + raise Exception("KMS Key ID not found.") + except ValueError: + return bad_request + + encrypted_message = encrypt(key_id, message) + response = {'data': encrypted_message} + + return { + 'statusCode': 200, + 'headers': { + 'Content-Type': 'application/json' + }, + 'body': json.dumps(response) + } diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/template.yaml new file mode 100644 index 0000000000..dc7bd9c05c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/encryption_proxy/template.yaml @@ -0,0 +1,129 @@ +AWSTemplateFormatVersion: "2010-09-09" +Description: | + This SAM example creates the following resources: + + Encryption Proxy: Comprised of Encryption and Decryption Lambda functions + IAM Roles + KMS Key: KMS Key and encrypt/decrypt permission for each IAM Role separately + + Last Modified: 22nd November 2016 Author: Heitor Lessa +Outputs: + DecryptFunction: + Description: "Decryption Lambda Function ARN" + Value: DecryptionFunction.Arn + DecryptURL: + Description: "Decrypt endpoint URL for Stage environment" + Value: "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Stage/decrypt" + EncryptFunction: + Description: "Encryption Lambda Function ARN" + Value: EncryptionFunction.Arn + EncryptURL: + Description: "Encrypt endpoint URL for Stage environment" + Value: "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Stage/encrypt" +Resources: + EncryptionDecryptionKey: + Properties: + Description: "Encryption and Decryption key for Lambda" + KeyPolicy: + Id: LambdaEncDec + Statement: + - + Action: + - "kms:Create*" + - "kms:Describe*" + - "kms:Enable*" + - "kms:List*" + - "kms:Put*" + - "kms:Update*" + - "kms:Revoke*" + - "kms:Disable*" + - "kms:Get*" + - "kms:Delete*" + - "kms:ScheduleKeyDeletion" + - "kms:CancelKeyDeletion" + Effect: Allow + Principal: + AWS: "AWS::AccountId" + Resource: "*" + Sid: "Allow administration of the key" + - + Action: + - "kms:Encrypt" + Effect: Allow + Principal: + AWS: EncryptionServiceIAMRole.Arn + Resource: "*" + Sid: "Allow Encryption Service to use this key" + - + Action: + - "kms:Decrypt" + Effect: Allow + Principal: + AWS: DecryptionServiceIAMRole.Arn + Resource: "*" + Sid: "Allow Decryption Service to use this key" + Version: "2012-10-17" + Type: "AWS::KMS::Key" + EncryptionServiceIAMRole: + DecryptionFunction: + Properties: + CodeUri: "s3:///encryption_proxy.zip" + Events: + decryptAction: + Properties: + Method: post + Path: /decrypt + Type: Api + Handler: decryption.post + Role: DecryptionServiceIAMRole.Arn + Runtime: python2.7 + Type: "AWS::Serverless::Function" + DecryptionServiceIAMRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - + Action: + - "sts:AssumeRole" + Effect: Allow + Principal: + Service: + - lambda.amazonaws.com + Sid: AllowLambdaServiceToAssumeRole + Version: "2012-10-17" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + Path: / + Type: "AWS::IAM::Role" + EncryptionFunction: + Properties: + CodeUri: "s3:///encryption_proxy.zip" + Environment: + Variables: + keyId: EncryptionDecryptionKey + Events: + encryptAction: + Properties: + Method: post + Path: /encrypt + Type: Api + Handler: encryption.post + Role: EncryptionServiceIAMRole.Arn + Runtime: python2.7 + Type: "AWS::Serverless::Function" + Properties: + AssumeRolePolicyDocument: + Statement: + - + Action: + - "sts:AssumeRole" + Effect: Allow + Principal: + Service: + - lambda.amazonaws.com + Sid: AllowLambdaServiceToAssumeRole + Version: "2012-10-17" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + Path: / + Type: "AWS::IAM::Role" +Transform: "AWS::Serverless-2016-10-31" diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/function.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/function.yaml new file mode 100644 index 0000000000..0b89c7a52e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/function.yaml @@ -0,0 +1,29 @@ +Transform: AWS::Serverless-2016-10-31 +Resources: + TestFunction: + Type: AWS::Serverless::Function + Properties: + Handler: file.method + Runtime: nodejs + CodeUri: s3://bucket/path/key + FunctionName: functionname + Description: description + MemorySize: 128 + Timeout: 30 + Role: aws::arn::123456789012::some/role + Policies: + - AmazonDynamoDBFullAccess + Environment: + Variables: + NAME: VALUE + VpcConfig: + SecurityGroupIds: + - String + SubnetIds: + - String + Events: + TestApi: + Type: Api + Properties: + Path: /testing + Method: any \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/hello_world/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/hello_world/index.js new file mode 100644 index 0000000000..300dd0e6d0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/hello_world/index.js @@ -0,0 +1,6 @@ +'use strict'; +console.log('Loading function'); + +exports.handler = (event, context, callback) => { + callback(null, 'Hello World!'); +}; \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/hello_world/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/hello_world/template.yaml new file mode 100644 index 0000000000..d0f01b66f5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/hello_world/template.yaml @@ -0,0 +1,17 @@ +AWSTemplateFormatVersion : '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: A hello world application. +Parameters: + Bucket: + Type: String + CodeZipKey: + Type: String +Resources: + HelloWorldFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs4.3 + CodeUri: + Bucket: !Bucket + Key: !CodeZipKey diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/inline_swagger/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/inline_swagger/index.js new file mode 100644 index 0000000000..7f7a6018dd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/inline_swagger/index.js @@ -0,0 +1,6 @@ +exports.handler = function(event, context, callback) { + callback(null, { + "statusCode": 200, + "body": "hello world" + }); +} diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/inline_swagger/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/inline_swagger/template.yaml new file mode 100644 index 0000000000..b9dc3018c4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/inline_swagger/template.yaml @@ -0,0 +1,41 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Simple API Endpoint configured using Swagger specified inline and backed by a Lambda function +Resources: + MyApi: + Type: AWS::Serverless::Api + Properties: + StageName: prod + DefinitionBody: + swagger: 2.0 + info: + title: + Ref: AWS::StackName + paths: + "/get": + get: + x-amazon-apigateway-integration: + httpMethod: POST + type: aws_proxy + uri: + Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyLambdaFunction.Arn}/invocations + responses: {} + swagger: '2.0' + + + + MyLambdaFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs4.3 + CodeUri: s3:///inline_swagger.zip + Events: + GetApi: + Type: Api + Properties: + Path: /get + Method: GET + RestApiId: + Ref: MyApi + diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/iot_backend/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/iot_backend/index.js new file mode 100644 index 0000000000..b18f84d411 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/iot_backend/index.js @@ -0,0 +1,30 @@ +console.log('Loading function'); + +var AWS = require('aws-sdk'); +var dynamo = new AWS.DynamoDB.DocumentClient(); +var table = process.env.TABLE_NAME; + +exports.handler = function(event, context, callback) { + //console.log('Received event:', JSON.stringify(event, null, 2)); + + var params = { + TableName:table, + Item:{ + "id": event.id, + "thing": event.thing + } + }; + + console.log("Adding a new IoT device..."); + dynamo.put(params, function(err, data) { + if (err) { + console.error("Unable to add device. Error JSON:", JSON.stringify(err, null, 2)); + callback(err); + } else { + console.log("Added device:", JSON.stringify(data, null, 2)); + callback(null,'DynamoDB updated'); + } + }); + + +} diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/iot_backend/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/iot_backend/template.yaml new file mode 100644 index 0000000000..8486c72a79 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/iot_backend/template.yaml @@ -0,0 +1,29 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: IoT -> Lambda -> DynamoDB +Resources: + IoTFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs4.3 + CodeUri: s3:///iot_backend.zip + Policies: AmazonDynamoDBFullAccess + Environment: + Variables: + TABLE_NAME: + Ref: Table + Events: + IoT: + Type: IoTRule + Properties: + AwsIotSqlVersion: 2016-03-23 + Sql: "SELECT * FROM 'iot2ddb'" + Table: + Type: AWS::Serverless::SimpleTable + Properties: + PrimaryKey: + Name: id + Type: String + + diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/s3_processor/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/s3_processor/index.js new file mode 100644 index 0000000000..ad412345b2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/s3_processor/index.js @@ -0,0 +1,26 @@ +'use strict'; +console.log('Loading function'); + +let aws = require('aws-sdk'); +let s3 = new aws.S3({ apiVersion: '2006-03-01' }); + +exports.handler = (event, context, callback) => { + // Get the object from the event and show its content type + const bucket = event.Records[0].s3.bucket.name; + const key = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, ' ')); + const params = { + Bucket: bucket, + Key: key + }; + s3.getObject(params, (err, data) => { + if (err) { + console.log(err); + const message = `Error getting object ${key} from bucket ${bucket}. Make sure they exist and your bucket is in the same region as this function.`; + console.log(message); + callback(message); + } else { + console.log('CONTENT TYPE:', data.ContentType); + callback(null, data.ContentType); + } + }); +}; \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/s3_processor/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/s3_processor/template.yaml new file mode 100644 index 0000000000..5ff7aa2c29 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/s3_processor/template.yaml @@ -0,0 +1,22 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: A function is triggered off an upload to a bucket. It logs the content type of the uploaded object. +Resources: + ProcessorFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs4.3 + CodeUri: s3:///s3_processor.zip + Policies: AmazonS3ReadOnlyAccess + Events: + PhotoUpload: + Type: S3 + Properties: + Bucket: !Ref Bucket + Events: s3:ObjectCreated:* + + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: Test \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/schedule/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/schedule/index.js new file mode 100644 index 0000000000..d77afb94bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/schedule/index.js @@ -0,0 +1,7 @@ +'use strict'; +console.log('Loading function'); + +exports.handler = (event, context, callback) => { + console.log("Invocation with event =", event); + callback(null, 'Everything is ok!'); +}; \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/schedule/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/schedule/template.yaml new file mode 100644 index 0000000000..4bd022e8c9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/schedule/template.yaml @@ -0,0 +1,15 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: A function triggered on a timer. +Resources: + ScheduledFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs4.3 + CodeUri: s3:///schedule.zip + Events: + Timer: + Type: Schedule + Properties: + Schedule: rate(5 minutes) \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/stream_processor/index.js b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/stream_processor/index.js new file mode 100644 index 0000000000..ea051babc8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/stream_processor/index.js @@ -0,0 +1,11 @@ +'use strict'; +console.log('Loading function'); + +exports.handler = (event, context, callback) => { + event.Records.forEach((record) => { + // Kinesis data is base64 encoded so decode here + const payload = new Buffer(record.kinesis.data, 'base64').toString('ascii'); + console.log('Decoded payload:', payload); + }); + callback(null, `Successfully processed ${event.Records.length} records.`); +}; \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/stream_processor/template.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/stream_processor/template.yaml new file mode 100644 index 0000000000..48de30be6b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/stream_processor/template.yaml @@ -0,0 +1,21 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: A function that processes data from a Kinesis stream. +Resources: + StreamProcessor: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs4.3 + CodeUri: s3:///stream_processor.zip + Events: + Stream: + Type: Kinesis + Properties: + Stream: !GetAtt Stream.Arn + StartingPosition: TRIM_HORIZON + + Stream: + Type: AWS::Kinesis::Stream + Properties: + ShardCount: 1 diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/basic.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/basic.yaml new file mode 100644 index 0000000000..eb8dc991ab --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/basic.yaml @@ -0,0 +1,13 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Alexa Skill https://developer.amazon.com/alexa-skills-kit +Resources: + AlexaSkillFunction: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3:///alexa_skill.zip + Handler: index.handler + Runtime: nodejs4.3 + Events: + AlexaSkillEvent: + Type: AlexaSkill \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/intrinsic.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/intrinsic.yaml new file mode 100644 index 0000000000..caf18af6d6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/intrinsic.yaml @@ -0,0 +1,29 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Alexa Skill https://developer.amazon.com/alexa-skills-kit +Resources: + AlexaSkillFunction: + Type: AWS::Serverless::Function + Properties: + CodeUri: s3:///alexa_skill.zip + Handler: index.handler + Runtime: !Ref InlineParameter + Environment: + Variables: + BASE_64_SIMPLE: !Base64 "123456" + # TODO More Base64 + # TODO Conditionals + # TODO FindInMap + GET_ATT: + "Fn::GetAtt": [ "SomeResource", "AndParameter" ] + # TODO ImportValue + # TODO Join + # TODO Select + # TODO Split + SUB_SIMPLE: !Sub "Building with ${AWS::Region} parameters and ${SomeCustom} ones" + SUB_FULL: + "Fn::Sub": + - "Some full text with ${AWS::Region} parameters and ${CustomParams}" + - { "CustomParams": "${SomeOtherResource}" } + + diff --git a/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/wrong.yaml b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/wrong.yaml new file mode 100644 index 0000000000..de8ae7dcc5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/sam-official-samples/templates/wrong.yaml @@ -0,0 +1,12 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: Alexa Skill https://developer.amazon.com/alexa-skills-kit +Resources: + AlexaSkillFunction: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs4.3 + Events: + AlexaSkillEvent: + Type: AlexaSkill \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/validation-errors/no-resources-section.yaml b/vendor/github.com/awslabs/goformation/test/yaml/validation-errors/no-resources-section.yaml new file mode 100644 index 0000000000..ee4bec3f97 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/validation-errors/no-resources-section.yaml @@ -0,0 +1,2 @@ +AWSTemplateFormatVersion: 2010-09-09 +Transform: AWS::Serverless-2016-10-31 \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/test/yaml/yaml-intrinsic-tags.yaml b/vendor/github.com/awslabs/goformation/test/yaml/yaml-intrinsic-tags.yaml new file mode 100644 index 0000000000..acf724ad24 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test/yaml/yaml-intrinsic-tags.yaml @@ -0,0 +1,13 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: SAM template for testing intrinsic functions with YAML tags +Parameters: + TimeoutParam: + Type: Number + Default: 10 +Resources: + IntrinsicFunctionTest: + Type: AWS::Serverless::Function + Properties: + Runtime: !Sub "${ParamNotExists}4.3" + Timeout: !Ref TimeoutParam diff --git a/vendor/github.com/awslabs/goformation/unmarshal.go b/vendor/github.com/awslabs/goformation/unmarshal.go deleted file mode 100644 index 84aa29bad9..0000000000 --- a/vendor/github.com/awslabs/goformation/unmarshal.go +++ /dev/null @@ -1,311 +0,0 @@ -package goformation - -import ( - "regexp" - - . "github.com/awslabs/goformation/resources" - "github.com/awslabs/goformation/util" - "gopkg.in/yaml.v2" -) - -func unmarshal(input []byte) (Template, error) { - util.LogDebug(-1, "Unmarshalling", "Unmarshalling process started") - - var source = input - var error error - template := &unmarshalledTemplate{} - - if err := yaml.Unmarshal(source, template); err != nil { - util.LogError(-1, "Unmarshalling", "There was a problem when unmarshalling the template") - util.LogError(-1, "Unmarshalling", "%s", err.Error()) - return nil, err - } - - util.LogDebug(-1, "Unmarshalling", "Storing line numbers for the components") - - // Process and store line numbers for giving comprehensive error messages. - lineAnalysis := ProcessLineNumbers(source) - template._lineNumbers = lineAnalysis - - return template, error -} - -// BEGIN unmarshalledTemplate definition - and sons -type unmarshalledTemplate struct { - _version string `yaml:"AWSTemplateFormatVersion"` - _transform []string `yaml:"Transform"` - _unmarshalledParameters map[string]unmarshalledParameter `yaml:"Parameters"` - _resources map[string]*unmarshalledResource `yaml:"Resources"` - _outputs map[string]output `yaml:"Outputs"` - _lineNumbers LineDictionary -} - -func (t *unmarshalledTemplate) UnmarshalYAML(unmarshal func(interface{}) error) (err error) { - - var aux map[string]interface{} - if err = unmarshal(&aux); err != nil { - return err - } - - for key, value := range aux { - switch key { - case "AWSTemplateFormatVersion": - t._version = util.ParsePrimitive(value).(string) - case "Transform": - if valueArray, ok := value.([]string); ok { - t._transform = valueArray - } else { - stringTransform := util.ParsePrimitive(value).(string) - t._transform = []string{stringTransform} - } - case "Resources": - util.ParseComplex(value, &t._resources) - } - } - - return nil -} - -func (t *unmarshalledTemplate) Version() string { - return t._version -} -func (t *unmarshalledTemplate) Transform() []string { - return t._transform -} -func (t *unmarshalledTemplate) Parameters() map[string]Parameter { - ret := make(map[string]Parameter) - for key, value := range t._unmarshalledParameters { - ret[key] = &value - } - return ret -} -func getResourceAddr(input Resource) Resource { - return input -} -func (t *unmarshalledTemplate) Resources() map[string]Resource { - ret := make(map[string]Resource) - for key, value := range t._resources { - if value == nil { - value = &unmarshalledResource{} - } - ret[key] = getResourceAddr(value) - } - return ret -} -func (t *unmarshalledTemplate) Outputs() map[string]Output { - ret := make(map[string]Output) - for key, value := range t._outputs { - ret[key] = &value - } - return ret -} - -func (t *unmarshalledTemplate) GetResourcesByType(resourceType string) map[string]Resource { - return nil -} - -type unmarshalledParameter struct { - PAllowedPattern string `yaml:"AllowedPattern"` - PAllowedValues []string `yaml:"AllowedValues"` - PConstraintDescription string `yaml:"ConstraintDescription"` - PDefault string `yaml:"Default"` - PDescription string `yaml:"Description"` - PMaxLength string `yaml:"MaxLength"` - PMaxValue string `yaml:"MaxValue"` - PMinLength string `yaml:"MinLength"` - PMinValue string `yaml:"MinValue"` - PNoEcho string `yaml:"NoEcho"` - PType string `yaml:"Type"` -} - -func (p *unmarshalledParameter) AllowedPattern() string { - return p.PAllowedPattern -} -func (p *unmarshalledParameter) AllowedValues() []string { - return p.PAllowedValues -} -func (p *unmarshalledParameter) ConstraintDescription() string { - return p.PConstraintDescription -} -func (p *unmarshalledParameter) Default() string { - return p.PDefault -} -func (p *unmarshalledParameter) Description() string { - return p.PDescription -} -func (p *unmarshalledParameter) MaxLength() string { - return p.PMaxLength -} -func (p *unmarshalledParameter) MaxValue() string { - return p.PMaxValue -} -func (p *unmarshalledParameter) MinLength() string { - return p.PMinLength -} -func (p *unmarshalledParameter) MinValue() string { - return p.PMinValue -} -func (p *unmarshalledParameter) NoEcho() string { - return p.PNoEcho -} -func (p *unmarshalledParameter) Type() string { - return p.PType -} - -type unmarshalledResource struct { - RType string `yaml:"Type"` - RProperties map[string]*unmarshalledProperty `yaml:"Properties"` -} - -func (r *unmarshalledResource) UnmarshalYAML(unmarshal func(interface{}) error) (err error) { - - var aux map[string]interface{} - if err = unmarshal(&aux); err != nil { - - return err - } - - r.RType = util.ParsePrimitive(aux["Type"]).(string) - util.ParseComplex(aux["Properties"], &r.RProperties) - - return nil -} - -func (r *unmarshalledResource) Type() string { - return r.RType -} - -func setPropertyKey(props map[string]Property, key string, value Property) { - props[key] = value -} -func (r *unmarshalledResource) Properties() map[string]Property { - props := make(map[string]Property) - for key, value := range r.RProperties { - setPropertyKey(props, key, value) - } - return props -} - -func (r *unmarshalledResource) ReturnValues() map[string]string { - return nil -} - -type unmarshalledProperty struct { - PValue interface{} -} - -func (p *unmarshalledProperty) UnmarshalYAML(unmarshal func(interface{}) error) (err error) { - - var aux interface{} - if err = unmarshal(&aux); err != nil { - return err - } - - p.PValue = aux - - return nil -} - -func (p *unmarshalledProperty) Value() interface{} { - return p.PValue -} -func (p *unmarshalledProperty) Original() interface{} { - if p == nil { - return nil - } - return p.PValue -} -func (p *unmarshalledProperty) HasFn() bool { - return false -} - -// TODO Implement outputs -type output struct { - _description string `yaml:"Description"` - _value string `yaml:"Value"` - _export outputExport `yaml:"Export"` -} - -func (o *output) Description() string { - return o._description -} -func (o *output) Value() string { - return o._value -} -func (o *output) Export() ExportParam { - return &o._export -} - -type outputExport struct { - _name string `yaml:"Name"` -} - -func (oe *outputExport) Name() string { - return oe._name -} - -// END unmarshalledTemplate definition - and sons - -func processIntrinsicFunctions(input []byte) (source []byte, error error) { - var okRegular = true - var okComplexSub = true - - // var stringTpl string = string(input) - // // Find inline Intrinsic Functions: - // XXX This does not accept double-quoted stuff inside intrinsic functions - special look at Fn::Sub... - var inlineFnRegex = `[\n\t\s]*!(Base64|FindInMap|GetAtt|GetAZs|ImportValue|Join|Select|Split|Sub|Ref) ([\'\"]?([a-zA-Z0-9_\.:\-$\{\}\/])+[\'\"]?|\[?((?:::|[a-zA-Z0-9_\.:\-$\{\}\/\[\],\'\" !])+)\]?)` - hasInlineFn, error := regexp.Match(inlineFnRegex, input) - if error != nil { - util.LogError(-1, "Unmarshalling", "%s", error.Error()) - return nil, error - } else if hasInlineFn { - regex := regexp.MustCompile(inlineFnRegex) - tmpSource := regex.ReplaceAllString(string(input), ` [ "Fn::$1",T3mpqu0T35Start $2 T3mPQu0T35End ]`) - quotesWithQuotesMsgStartRegex := regexp.MustCompile(`T3mpqu0T35Start \"`) - quotesWithQuotesMsgEndRegex := regexp.MustCompile(`\" T3mPQu0T35End`) - quotesWithArrayMsgStartRegex := regexp.MustCompile(`T3mpqu0T35Start \[`) - quotesWithArrayMsgEndRegex := regexp.MustCompile(`\] T3mPQu0T35End`) - quotesWithoutQuotesMsgStartRegex := regexp.MustCompile(`T3mpqu0T35Start `) - quotesWithoutQuotesMsgEndRegex := regexp.MustCompile(` T3mPQu0T35End`) - fakeQuoteRegex := regexp.MustCompile(`F4k3Qu0T3`) - - // Replace with quotes first - tmpSource = quotesWithQuotesMsgStartRegex.ReplaceAllString(tmpSource, "F4k3Qu0T3") - tmpSource = quotesWithQuotesMsgEndRegex.ReplaceAllString(tmpSource, "F4k3Qu0T3") - - // Now replace instances with an array - tmpSource = quotesWithArrayMsgStartRegex.ReplaceAllString(tmpSource, "[") - tmpSource = quotesWithArrayMsgEndRegex.ReplaceAllString(tmpSource, "]") - - // And now without quotes - tmpSource = quotesWithoutQuotesMsgStartRegex.ReplaceAllString(tmpSource, "F4k3Qu0T3") - tmpSource = quotesWithoutQuotesMsgEndRegex.ReplaceAllString(tmpSource, "F4k3Qu0T3") - - // Replace fake quotes - tmpSource = fakeQuoteRegex.ReplaceAllString(tmpSource, "\"") - - // Assign back to real source - source = []byte(tmpSource) - } else { - okRegular = false - } - - // Try to find for Sub with array - var subArrayFnRegex = `[\n\t\s]*!Sub\s*\n\s+\t*\-\s*\[\'\"]?([a-zA-Z0-9:_\.\-\$\{\}\/]+)\[\'\"]?\s*\n\s+\t*\-\s*(\{\s*[\"\-\$\:\{\}\,\sa-zA-Z0-9]+\s*\})` - hasSubFn, error := regexp.Match(subArrayFnRegex, source) - if error != nil { - util.LogError(-1, "Unmarshalling", "Error trying to find Array !Sub") - return nil, error - } else if hasSubFn { - compiledRegex := regexp.MustCompile(subArrayFnRegex) - source = compiledRegex.ReplaceAll(source, []byte(` [ "Fn::Sub",$1,$2 ]`)) - } else { - okComplexSub = false - } - - if !okRegular && !okComplexSub { - return source, ErrNoIntrinsicFunctionFound - } - - return source, error -} diff --git a/vendor/github.com/awslabs/goformation/util/error-tools.go b/vendor/github.com/awslabs/goformation/util/error-tools.go deleted file mode 100644 index eac5ef5585..0000000000 --- a/vendor/github.com/awslabs/goformation/util/error-tools.go +++ /dev/null @@ -1,106 +0,0 @@ -package util - -import ( - "fmt" - "strconv" - "strings" - - "regexp" - - "github.com/pkg/errors" -) - -var ( - // ErrFailedToReadTemplate is thrown when the provided template - // file cannot be opened (e.g. filesystem permissions/non-existant) - ErrFailedToReadTemplate = errors.New("failed to open template") - - // ErrFailedToParseTemplate is thrown when the provided template - // is not valid (e.g. bad YAML syntax) - ErrFailedToParseTemplate = errors.New("ERROR: Failed to parse template") - - // ErrUnsupportedTemplateVersion is thrown when trying to parse a - // template that has a version of AWS SAM we haven't seen before - ErrUnsupportedTemplateVersion = errors.New("unsupported template version") - - // ErrFailedToUnmarshalTemplate is thrown when the unmarshalling process fails. - ErrFailedToUnmarshalTemplate = errors.New("ERROR: Failed to unmarshal template") - - // ErrFailedToScaffoldTemplate is thrown when the scaffolding process fails. - ErrFailedToScaffoldTemplate = errors.New("ERROR: Failed to scaffold template") -) - -var yamlErrorRegex = regexp.MustCompile(`yaml:\s+line\s+(\d+):(.+)`) - -// GetUnmarshallingErrorMessage Converts an error from the unmarshaller into a common format. -func GetUnmarshallingErrorMessage(error error) string { - errorMessage := error.Error() - if !yamlErrorRegex.MatchString(errorMessage) { - return errorMessage - } - - parsedErrorMessage := yamlErrorRegex.FindStringSubmatch(errorMessage) - - lineNumber := 0 - lineNumber, err := strconv.Atoi(parsedErrorMessage[1]) - if err != nil { - lineNumber = 0 - } - - innerErrorMessage := parsedErrorMessage[2] - - // Let's have a nicer error message - if innerErrorMessage == " did not find expected key" { - lineNumber++ - innerErrorMessage = "Invalid indentation in template" - } - - finalErrorMessage := fmt.Sprintf("ERROR: %s (line: %d; col: 0)", innerErrorMessage, lineNumber) - return finalErrorMessage -} - -var unvalidLineRegex = regexp.MustCompile(`\(line: \-1:`) -var trimMessageRegex = regexp.MustCompile(`:\s$`) -var errorSubstitutionRegex = regexp.MustCompile(`###`) - -func GetFinalErrorMessage(error error) string { - finalErrorMessage := "ERROR: " - parsedMessage := recursivelyLookupErrorMessage(error, "") - - trimmedMessage := trimMessageRegex.ReplaceAllString(parsedMessage, "") - finalErrorMessage += trimmedMessage - - return finalErrorMessage -} - -func recursivelyLookupErrorMessage(error error, previousMessage string) string { - errorMsg := error.Error() - if errorMsg == previousMessage { - return errorMsg - } - - errorCause := errors.Cause(error) - causeMessage := errorCause.Error() - if causeMessage == errorMsg { - return errorMsg - } - - previousStack := recursivelyLookupErrorMessage(errorCause, errorMsg) - - matchErrorMessage := ": " + previousStack - originalMessage := strings.Replace(errorMsg, matchErrorMessage, "", 1) - - var messageToReturn = originalMessage - if unvalidLineRegex.MatchString(originalMessage) { - messageToReturn = previousStack - } else if len(originalMessage) < 3 { - messageToReturn = previousStack - } - - var parsedMessage = messageToReturn - if errorSubstitutionRegex.MatchString(messageToReturn) { - parsedMessage = errorSubstitutionRegex.ReplaceAllString(messageToReturn, previousStack) - } - - return parsedMessage -} diff --git a/vendor/github.com/awslabs/goformation/util/logger.go b/vendor/github.com/awslabs/goformation/util/logger.go deleted file mode 100644 index aed4c928b8..0000000000 --- a/vendor/github.com/awslabs/goformation/util/logger.go +++ /dev/null @@ -1,85 +0,0 @@ -package util - -import ( - "log" - "regexp" - "strings" -) - -var logs = map[string][]string{ - "DEBUG": []string{}, - "INFO": []string{}, - "WARN": []string{}, - "ERROR": []string{}, - "FATAL": []string{}, -} - -// GetLogs Returns the logs fetched during the parsing process of your template. -func GetLogs() map[string][]string { - return logs -} - -// LogDebug adds a line of DEBUG log -func LogDebug(line int, place string, message string, arguments ...interface{}) { - logRaw("DEBUG", line, place, message, arguments) -} - -// LogInfo adds a line of INFO log -func LogInfo(line int, place string, message string, arguments ...interface{}) { - logRaw("INFO", line, place, message, arguments) -} - -// LogWarning adds a line of WARNING log -func LogWarning(line int, place string, message string, arguments ...interface{}) { - logRaw("WARN", line, place, message, arguments) -} - -// LogError adds a line of ERROR log -func LogError(line int, place string, message string, arguments ...interface{}) { - logRaw("ERROR", line, place, message, arguments) -} - -// LogCritical adds a line of CRITICAL log -func logCritical(line int, place string, message string, arguments ...interface{}) { - logRaw("FATAL", line, place, message, arguments) -} - -func logRaw(logType string, line int, place string, message string, arguments []interface{}) { - parameterRegex := regexp.MustCompile(`\%(s|d)`) - var processedMessage = message - - occurrences := parameterRegex.FindAllString(message, -1) - if len(occurrences) != len(arguments) { - log.Panic("Trying to log with different argument and placeholder numbers") - } - - for key, occurrence := range occurrences { - value := arguments[key] - - var stringValue string - switch value.(type) { - case string: - stringValue = value.(string) - case int: - stringValue = string(value.(int)) - case int64: - stringValue = string(value.(int64)) - case []string: - stringValue = strings.Join(value.([]string), ", ") - default: - stringValue = "Object [Object]" - } - - messageSplit := strings.SplitN(processedMessage, occurrence, 2) - processedMessage = strings.Join(messageSplit, stringValue) - } - - strLog := "" - if line != -1 { - strLog = processedMessage + ` - ` + place + `(` + string(line) + `).` - } else { - strLog = processedMessage + ` - ` + place + `.` - } - - logs[logType] = append(logs[logType], strLog) -} diff --git a/vendor/github.com/awslabs/goformation/util/marshal-tools.go b/vendor/github.com/awslabs/goformation/util/marshal-tools.go deleted file mode 100644 index 67b3d1d285..0000000000 --- a/vendor/github.com/awslabs/goformation/util/marshal-tools.go +++ /dev/null @@ -1,61 +0,0 @@ -package util - -import ( - "gopkg.in/yaml.v2" -) - -// ParsePrimitive parses a primitive value from the template -func ParsePrimitive(source interface{}) interface{} { - if v, ok := source.(string); ok { - return v - } else if v, ok := source.(bool); ok { - return v - } else if v, ok := source.(int); ok { - return v - } - return "" -} - -// ParseComplex parses a complex value from the template -func ParseComplex(source interface{}, destination interface{}) { - - enc, err := yaml.Marshal(source) - if err != nil { - LogError(-1, "UNDEFINED", "%s", err) - } - if err := yaml.Unmarshal(enc, destination); err != nil { - LogError(-1, "UNDEFINED", "%s", err) - } -} - -// GetValueType returns the data type of a value given -func GetValueType(value interface{}) string { - switch value.(type) { - case string: - return "string" - case int: - return "int" - case int64: - return "int64" - case float32: - return "float32" - case float64: - return "float64" - case bool: - return "bool" - case []string: - return "[]string" - case []int: - return "[]int" - case []int64: - return "[]int64" - case []float32: - return "[]float32" - case []float64: - return "[]float64" - case []bool: - return "[]bool" - default: - return "Unknown" - } -} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/LICENSE b/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/LICENSE new file mode 100644 index 0000000000..7805d36de7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/LICENSE @@ -0,0 +1,50 @@ +The MIT License (MIT) + +Copyright (c) 2014 Sam Ghods + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/README.md b/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/README.md new file mode 100644 index 0000000000..0200f75b4d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/README.md @@ -0,0 +1,121 @@ +# YAML marshaling and unmarshaling support for Go + +[![Build Status](https://travis-ci.org/ghodss/yaml.svg)](https://travis-ci.org/ghodss/yaml) + +## Introduction + +A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs. + +In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/). + +## Compatibility + +This package uses [go-yaml](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility). + +## Caveats + +**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example: + +``` +BAD: + exampleKey: !!binary gIGC + +GOOD: + exampleKey: gIGC +... and decode the base64 data in your code. +``` + +**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys. + +## Installation and usage + +To install, run: + +``` +$ go get github.com/ghodss/yaml +``` + +And import using: + +``` +import "github.com/ghodss/yaml" +``` + +Usage is very similar to the JSON library: + +```go +package main + +import ( + "fmt" + + "github.com/ghodss/yaml" +) + +type Person struct { + Name string `json:"name"` // Affects YAML field names too. + Age int `json:"age"` +} + +func main() { + // Marshal a Person struct to YAML. + p := Person{"John", 30} + y, err := yaml.Marshal(p) + if err != nil { + fmt.Printf("err: %v\n", err) + return + } + fmt.Println(string(y)) + /* Output: + age: 30 + name: John + */ + + // Unmarshal the YAML back into a Person struct. + var p2 Person + err = yaml.Unmarshal(y, &p2) + if err != nil { + fmt.Printf("err: %v\n", err) + return + } + fmt.Println(p2) + /* Output: + {John 30} + */ +} +``` + +`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available: + +```go +package main + +import ( + "fmt" + + "github.com/ghodss/yaml" +) + +func main() { + j := []byte(`{"name": "John", "age": 30}`) + y, err := yaml.JSONToYAML(j) + if err != nil { + fmt.Printf("err: %v\n", err) + return + } + fmt.Println(string(y)) + /* Output: + name: John + age: 30 + */ + j2, err := yaml.YAMLToJSON(y) + if err != nil { + fmt.Printf("err: %v\n", err) + return + } + fmt.Println(string(j2)) + /* Output: + {"age":30,"name":"John"} + */ +} +``` diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/fields.go b/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/fields.go new file mode 100644 index 0000000000..5860074026 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/fields.go @@ -0,0 +1,501 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +package yaml + +import ( + "bytes" + "encoding" + "encoding/json" + "reflect" + "sort" + "strings" + "sync" + "unicode" + "unicode/utf8" +) + +// indirect walks down v allocating pointers as needed, +// until it gets to a non-pointer. +// if it encounters an Unmarshaler, indirect stops and returns that. +// if decodingNull is true, indirect stops at the last pointer so it can be set to nil. +func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { + // If v is a named type and is addressable, + // start with its address, so that if the type has pointer methods, + // we find them. + if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + v = v.Addr() + } + for { + // Load value from interface, but only if the result will be + // usefully addressable. + if v.Kind() == reflect.Interface && !v.IsNil() { + e := v.Elem() + if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { + v = e + continue + } + } + + if v.Kind() != reflect.Ptr { + break + } + + if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { + break + } + if v.IsNil() { + if v.CanSet() { + v.Set(reflect.New(v.Type().Elem())) + } else { + v = reflect.New(v.Type().Elem()) + } + } + if v.Type().NumMethod() > 0 { + if u, ok := v.Interface().(json.Unmarshaler); ok { + return u, nil, reflect.Value{} + } + if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { + return nil, u, reflect.Value{} + } + } + v = v.Elem() + } + return nil, nil, v +} + +// A field represents a single field found in a struct. +type field struct { + name string + nameBytes []byte // []byte(name) + equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent + + tag bool + index []int + typ reflect.Type + omitEmpty bool + quoted bool +} + +func fillField(f field) field { + f.nameBytes = []byte(f.name) + f.equalFold = foldFunc(f.nameBytes) + return f +} + +// byName sorts field by name, breaking ties with depth, +// then breaking ties with "name came from json tag", then +// breaking ties with index sequence. +type byName []field + +func (x byName) Len() int { return len(x) } + +func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byName) Less(i, j int) bool { + if x[i].name != x[j].name { + return x[i].name < x[j].name + } + if len(x[i].index) != len(x[j].index) { + return len(x[i].index) < len(x[j].index) + } + if x[i].tag != x[j].tag { + return x[i].tag + } + return byIndex(x).Less(i, j) +} + +// byIndex sorts field by index sequence. +type byIndex []field + +func (x byIndex) Len() int { return len(x) } + +func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byIndex) Less(i, j int) bool { + for k, xik := range x[i].index { + if k >= len(x[j].index) { + return false + } + if xik != x[j].index[k] { + return xik < x[j].index[k] + } + } + return len(x[i].index) < len(x[j].index) +} + +// typeFields returns a list of fields that JSON should recognize for the given type. +// The algorithm is breadth-first search over the set of structs to include - the top struct +// and then any reachable anonymous structs. +func typeFields(t reflect.Type) []field { + // Anonymous fields to explore at the current level and the next. + current := []field{} + next := []field{{typ: t}} + + // Count of queued names for current level and the next. + count := map[reflect.Type]int{} + nextCount := map[reflect.Type]int{} + + // Types already visited at an earlier level. + visited := map[reflect.Type]bool{} + + // Fields found. + var fields []field + + for len(next) > 0 { + current, next = next, current[:0] + count, nextCount = nextCount, map[reflect.Type]int{} + + for _, f := range current { + if visited[f.typ] { + continue + } + visited[f.typ] = true + + // Scan f.typ for fields to include. + for i := 0; i < f.typ.NumField(); i++ { + sf := f.typ.Field(i) + if sf.PkgPath != "" { // unexported + continue + } + tag := sf.Tag.Get("json") + if tag == "-" { + continue + } + name, opts := parseTag(tag) + if !isValidTag(name) { + name = "" + } + index := make([]int, len(f.index)+1) + copy(index, f.index) + index[len(f.index)] = i + + ft := sf.Type + if ft.Name() == "" && ft.Kind() == reflect.Ptr { + // Follow pointer. + ft = ft.Elem() + } + + // Record found field and index sequence. + if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct { + tagged := name != "" + if name == "" { + name = sf.Name + } + fields = append(fields, fillField(field{ + name: name, + tag: tagged, + index: index, + typ: ft, + omitEmpty: opts.Contains("omitempty"), + quoted: opts.Contains("string"), + })) + if count[f.typ] > 1 { + // If there were multiple instances, add a second, + // so that the annihilation code will see a duplicate. + // It only cares about the distinction between 1 or 2, + // so don't bother generating any more copies. + fields = append(fields, fields[len(fields)-1]) + } + continue + } + + // Record new anonymous struct to explore in next round. + nextCount[ft]++ + if nextCount[ft] == 1 { + next = append(next, fillField(field{name: ft.Name(), index: index, typ: ft})) + } + } + } + } + + sort.Sort(byName(fields)) + + // Delete all fields that are hidden by the Go rules for embedded fields, + // except that fields with JSON tags are promoted. + + // The fields are sorted in primary order of name, secondary order + // of field index length. Loop over names; for each name, delete + // hidden fields by choosing the one dominant field that survives. + out := fields[:0] + for advance, i := 0, 0; i < len(fields); i += advance { + // One iteration per name. + // Find the sequence of fields with the name of this first field. + fi := fields[i] + name := fi.name + for advance = 1; i+advance < len(fields); advance++ { + fj := fields[i+advance] + if fj.name != name { + break + } + } + if advance == 1 { // Only one field with this name + out = append(out, fi) + continue + } + dominant, ok := dominantField(fields[i : i+advance]) + if ok { + out = append(out, dominant) + } + } + + fields = out + sort.Sort(byIndex(fields)) + + return fields +} + +// dominantField looks through the fields, all of which are known to +// have the same name, to find the single field that dominates the +// others using Go's embedding rules, modified by the presence of +// JSON tags. If there are multiple top-level fields, the boolean +// will be false: This condition is an error in Go and we skip all +// the fields. +func dominantField(fields []field) (field, bool) { + // The fields are sorted in increasing index-length order. The winner + // must therefore be one with the shortest index length. Drop all + // longer entries, which is easy: just truncate the slice. + length := len(fields[0].index) + tagged := -1 // Index of first tagged field. + for i, f := range fields { + if len(f.index) > length { + fields = fields[:i] + break + } + if f.tag { + if tagged >= 0 { + // Multiple tagged fields at the same level: conflict. + // Return no field. + return field{}, false + } + tagged = i + } + } + if tagged >= 0 { + return fields[tagged], true + } + // All remaining fields have the same length. If there's more than one, + // we have a conflict (two fields named "X" at the same level) and we + // return no field. + if len(fields) > 1 { + return field{}, false + } + return fields[0], true +} + +var fieldCache struct { + sync.RWMutex + m map[reflect.Type][]field +} + +// cachedTypeFields is like typeFields but uses a cache to avoid repeated work. +func cachedTypeFields(t reflect.Type) []field { + fieldCache.RLock() + f := fieldCache.m[t] + fieldCache.RUnlock() + if f != nil { + return f + } + + // Compute fields without lock. + // Might duplicate effort but won't hold other computations back. + f = typeFields(t) + if f == nil { + f = []field{} + } + + fieldCache.Lock() + if fieldCache.m == nil { + fieldCache.m = map[reflect.Type][]field{} + } + fieldCache.m[t] = f + fieldCache.Unlock() + return f +} + +func isValidTag(s string) bool { + if s == "" { + return false + } + for _, c := range s { + switch { + case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): + // Backslash and quote chars are reserved, but + // otherwise any punctuation chars are allowed + // in a tag name. + default: + if !unicode.IsLetter(c) && !unicode.IsDigit(c) { + return false + } + } + } + return true +} + +const ( + caseMask = ^byte(0x20) // Mask to ignore case in ASCII. + kelvin = '\u212a' + smallLongEss = '\u017f' +) + +// foldFunc returns one of four different case folding equivalence +// functions, from most general (and slow) to fastest: +// +// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 +// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') +// 3) asciiEqualFold, no special, but includes non-letters (including _) +// 4) simpleLetterEqualFold, no specials, no non-letters. +// +// The letters S and K are special because they map to 3 runes, not just 2: +// * S maps to s and to U+017F 'ſ' Latin small letter long s +// * k maps to K and to U+212A 'K' Kelvin sign +// See http://play.golang.org/p/tTxjOc0OGo +// +// The returned function is specialized for matching against s and +// should only be given s. It's not curried for performance reasons. +func foldFunc(s []byte) func(s, t []byte) bool { + nonLetter := false + special := false // special letter + for _, b := range s { + if b >= utf8.RuneSelf { + return bytes.EqualFold + } + upper := b & caseMask + if upper < 'A' || upper > 'Z' { + nonLetter = true + } else if upper == 'K' || upper == 'S' { + // See above for why these letters are special. + special = true + } + } + if special { + return equalFoldRight + } + if nonLetter { + return asciiEqualFold + } + return simpleLetterEqualFold +} + +// equalFoldRight is a specialization of bytes.EqualFold when s is +// known to be all ASCII (including punctuation), but contains an 's', +// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. +// See comments on foldFunc. +func equalFoldRight(s, t []byte) bool { + for _, sb := range s { + if len(t) == 0 { + return false + } + tb := t[0] + if tb < utf8.RuneSelf { + if sb != tb { + sbUpper := sb & caseMask + if 'A' <= sbUpper && sbUpper <= 'Z' { + if sbUpper != tb&caseMask { + return false + } + } else { + return false + } + } + t = t[1:] + continue + } + // sb is ASCII and t is not. t must be either kelvin + // sign or long s; sb must be s, S, k, or K. + tr, size := utf8.DecodeRune(t) + switch sb { + case 's', 'S': + if tr != smallLongEss { + return false + } + case 'k', 'K': + if tr != kelvin { + return false + } + default: + return false + } + t = t[size:] + + } + if len(t) > 0 { + return false + } + return true +} + +// asciiEqualFold is a specialization of bytes.EqualFold for use when +// s is all ASCII (but may contain non-letters) and contains no +// special-folding letters. +// See comments on foldFunc. +func asciiEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, sb := range s { + tb := t[i] + if sb == tb { + continue + } + if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') { + if sb&caseMask != tb&caseMask { + return false + } + } else { + return false + } + } + return true +} + +// simpleLetterEqualFold is a specialization of bytes.EqualFold for +// use when s is all ASCII letters (no underscores, etc) and also +// doesn't contain 'k', 'K', 's', or 'S'. +// See comments on foldFunc. +func simpleLetterEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, b := range s { + if b&caseMask != t[i]&caseMask { + return false + } + } + return true +} + +// tagOptions is the string following a comma in a struct field's "json" +// tag, or the empty string. It does not include the leading comma. +type tagOptions string + +// parseTag splits a struct field's json tag into its name and +// comma-separated options. +func parseTag(tag string) (string, tagOptions) { + if idx := strings.Index(tag, ","); idx != -1 { + return tag[:idx], tagOptions(tag[idx+1:]) + } + return tag, tagOptions("") +} + +// Contains reports whether a comma-separated list of options +// contains a particular substr flag. substr must be surrounded by a +// string boundary or commas. +func (o tagOptions) Contains(optionName string) bool { + if len(o) == 0 { + return false + } + s := string(o) + for s != "" { + var next string + i := strings.Index(s, ",") + if i >= 0 { + s, next = s[:i], s[i+1:] + } + if s == optionName { + return true + } + s = next + } + return false +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/yaml.go b/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/yaml.go new file mode 100644 index 0000000000..4fb4054a8b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/ghodss/yaml/yaml.go @@ -0,0 +1,277 @@ +package yaml + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strconv" + + "gopkg.in/yaml.v2" +) + +// Marshals the object into JSON then converts JSON to YAML and returns the +// YAML. +func Marshal(o interface{}) ([]byte, error) { + j, err := json.Marshal(o) + if err != nil { + return nil, fmt.Errorf("error marshaling into JSON: %v", err) + } + + y, err := JSONToYAML(j) + if err != nil { + return nil, fmt.Errorf("error converting JSON to YAML: %v", err) + } + + return y, nil +} + +// Converts YAML to JSON then uses JSON to unmarshal into an object. +func Unmarshal(y []byte, o interface{}) error { + vo := reflect.ValueOf(o) + j, err := yamlToJSON(y, &vo) + if err != nil { + return fmt.Errorf("error converting YAML to JSON: %v", err) + } + + err = json.Unmarshal(j, o) + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %v", err) + } + + return nil +} + +// Convert JSON to YAML. +func JSONToYAML(j []byte) ([]byte, error) { + // Convert the JSON to an object. + var jsonObj interface{} + // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the + // Go JSON library doesn't try to pick the right number type (int, float, + // etc.) when unmarshalling to interface{}, it just picks float64 + // universally. go-yaml does go through the effort of picking the right + // number type, so we can preserve number type throughout this process. + err := yaml.Unmarshal(j, &jsonObj) + if err != nil { + return nil, err + } + + // Marshal this object into YAML. + return yaml.Marshal(jsonObj) +} + +// Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through +// this method should be a no-op. +// +// Things YAML can do that are not supported by JSON: +// * In YAML you can have binary and null keys in your maps. These are invalid +// in JSON. (int and float keys are converted to strings.) +// * Binary data in YAML with the !!binary tag is not supported. If you want to +// use binary data with this library, encode the data as base64 as usual but do +// not use the !!binary tag in your YAML. This will ensure the original base64 +// encoded data makes it all the way through to the JSON. +func YAMLToJSON(y []byte) ([]byte, error) { + return yamlToJSON(y, nil) +} + +func yamlToJSON(y []byte, jsonTarget *reflect.Value) ([]byte, error) { + // Convert the YAML to an object. + var yamlObj interface{} + err := yaml.Unmarshal(y, &yamlObj) + if err != nil { + return nil, err + } + + // YAML objects are not completely compatible with JSON objects (e.g. you + // can have non-string keys in YAML). So, convert the YAML-compatible object + // to a JSON-compatible object, failing with an error if irrecoverable + // incompatibilties happen along the way. + jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget) + if err != nil { + return nil, err + } + + // Convert this object to JSON and return the data. + return json.Marshal(jsonObj) +} + +func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) { + var err error + + // Resolve jsonTarget to a concrete value (i.e. not a pointer or an + // interface). We pass decodingNull as false because we're not actually + // decoding into the value, we're just checking if the ultimate target is a + // string. + if jsonTarget != nil { + ju, tu, pv := indirect(*jsonTarget, false) + // We have a JSON or Text Umarshaler at this level, so we can't be trying + // to decode into a string. + if ju != nil || tu != nil { + jsonTarget = nil + } else { + jsonTarget = &pv + } + } + + // If yamlObj is a number or a boolean, check if jsonTarget is a string - + // if so, coerce. Else return normal. + // If yamlObj is a map or array, find the field that each key is + // unmarshaling to, and when you recurse pass the reflect.Value for that + // field back into this function. + switch typedYAMLObj := yamlObj.(type) { + case map[interface{}]interface{}: + // JSON does not support arbitrary keys in a map, so we must convert + // these keys to strings. + // + // From my reading of go-yaml v2 (specifically the resolve function), + // keys can only have the types string, int, int64, float64, binary + // (unsupported), or null (unsupported). + strMap := make(map[string]interface{}) + for k, v := range typedYAMLObj { + // Resolve the key to a string first. + var keyString string + switch typedKey := k.(type) { + case string: + keyString = typedKey + case int: + keyString = strconv.Itoa(typedKey) + case int64: + // go-yaml will only return an int64 as a key if the system + // architecture is 32-bit and the key's value is between 32-bit + // and 64-bit. Otherwise the key type will simply be int. + keyString = strconv.FormatInt(typedKey, 10) + case float64: + // Stolen from go-yaml to use the same conversion to string as + // the go-yaml library uses to convert float to string when + // Marshaling. + s := strconv.FormatFloat(typedKey, 'g', -1, 32) + switch s { + case "+Inf": + s = ".inf" + case "-Inf": + s = "-.inf" + case "NaN": + s = ".nan" + } + keyString = s + case bool: + if typedKey { + keyString = "true" + } else { + keyString = "false" + } + default: + return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v", + reflect.TypeOf(k), k, v) + } + + // jsonTarget should be a struct or a map. If it's a struct, find + // the field it's going to map to and pass its reflect.Value. If + // it's a map, find the element type of the map and pass the + // reflect.Value created from that type. If it's neither, just pass + // nil - JSON conversion will error for us if it's a real issue. + if jsonTarget != nil { + t := *jsonTarget + if t.Kind() == reflect.Struct { + keyBytes := []byte(keyString) + // Find the field that the JSON library would use. + var f *field + fields := cachedTypeFields(t.Type()) + for i := range fields { + ff := &fields[i] + if bytes.Equal(ff.nameBytes, keyBytes) { + f = ff + break + } + // Do case-insensitive comparison. + if f == nil && ff.equalFold(ff.nameBytes, keyBytes) { + f = ff + } + } + if f != nil { + // Find the reflect.Value of the most preferential + // struct field. + jtf := t.Field(f.index[0]) + strMap[keyString], err = convertToJSONableObject(v, &jtf) + if err != nil { + return nil, err + } + continue + } + } else if t.Kind() == reflect.Map { + // Create a zero value of the map's element type to use as + // the JSON target. + jtv := reflect.Zero(t.Type().Elem()) + strMap[keyString], err = convertToJSONableObject(v, &jtv) + if err != nil { + return nil, err + } + continue + } + } + strMap[keyString], err = convertToJSONableObject(v, nil) + if err != nil { + return nil, err + } + } + return strMap, nil + case []interface{}: + // We need to recurse into arrays in case there are any + // map[interface{}]interface{}'s inside and to convert any + // numbers to strings. + + // If jsonTarget is a slice (which it really should be), find the + // thing it's going to map to. If it's not a slice, just pass nil + // - JSON conversion will error for us if it's a real issue. + var jsonSliceElemValue *reflect.Value + if jsonTarget != nil { + t := *jsonTarget + if t.Kind() == reflect.Slice { + // By default slices point to nil, but we need a reflect.Value + // pointing to a value of the slice type, so we create one here. + ev := reflect.Indirect(reflect.New(t.Type().Elem())) + jsonSliceElemValue = &ev + } + } + + // Make and use a new array. + arr := make([]interface{}, len(typedYAMLObj)) + for i, v := range typedYAMLObj { + arr[i], err = convertToJSONableObject(v, jsonSliceElemValue) + if err != nil { + return nil, err + } + } + return arr, nil + default: + // If the target type is a string and the YAML type is a number, + // convert the YAML type to a string. + if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String { + // Based on my reading of go-yaml, it may return int, int64, + // float64, or uint64. + var s string + switch typedVal := typedYAMLObj.(type) { + case int: + s = strconv.FormatInt(int64(typedVal), 10) + case int64: + s = strconv.FormatInt(typedVal, 10) + case float64: + s = strconv.FormatFloat(typedVal, 'g', -1, 32) + case uint64: + s = strconv.FormatUint(typedVal, 10) + case bool: + if typedVal { + s = "true" + } else { + s = "false" + } + } + if len(s) > 0 { + yamlObj = interface{}(s) + } + } + return yamlObj, nil + } + + return nil, nil +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/LICENSE b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/LICENSE new file mode 100644 index 0000000000..f9c841a51e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Mitchell Hashimoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/README.md b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/README.md new file mode 100644 index 0000000000..659d6885fc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/README.md @@ -0,0 +1,46 @@ +# mapstructure + +mapstructure is a Go library for decoding generic map values to structures +and vice versa, while providing helpful error handling. + +This library is most useful when decoding values from some data stream (JSON, +Gob, etc.) where you don't _quite_ know the structure of the underlying data +until you read a part of it. You can therefore read a `map[string]interface{}` +and use this library to decode it into the proper underlying native Go +structure. + +## Installation + +Standard `go get`: + +``` +$ go get github.com/mitchellh/mapstructure +``` + +## Usage & Example + +For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/mapstructure). + +The `Decode` function has examples associated with it there. + +## But Why?! + +Go offers fantastic standard libraries for decoding formats such as JSON. +The standard method is to have a struct pre-created, and populate that struct +from the bytes of the encoded format. This is great, but the problem is if +you have configuration or an encoding that changes slightly depending on +specific fields. For example, consider this JSON: + +```json +{ + "type": "person", + "name": "Mitchell" +} +``` + +Perhaps we can't populate a specific structure without first reading +the "type" field from the JSON. We could always do two passes over the +decoding of the JSON (reading the "type" first, and the rest later). +However, it is much simpler to just decode this into a `map[string]interface{}` +structure, read the "type" key, then use something like this library +to decode it into the proper structure. diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/decode_hooks.go b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/decode_hooks.go new file mode 100644 index 0000000000..afcfd5eed6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/decode_hooks.go @@ -0,0 +1,152 @@ +package mapstructure + +import ( + "errors" + "reflect" + "strconv" + "strings" + "time" +) + +// typedDecodeHook takes a raw DecodeHookFunc (an interface{}) and turns +// it into the proper DecodeHookFunc type, such as DecodeHookFuncType. +func typedDecodeHook(h DecodeHookFunc) DecodeHookFunc { + // Create variables here so we can reference them with the reflect pkg + var f1 DecodeHookFuncType + var f2 DecodeHookFuncKind + + // Fill in the variables into this interface and the rest is done + // automatically using the reflect package. + potential := []interface{}{f1, f2} + + v := reflect.ValueOf(h) + vt := v.Type() + for _, raw := range potential { + pt := reflect.ValueOf(raw).Type() + if vt.ConvertibleTo(pt) { + return v.Convert(pt).Interface() + } + } + + return nil +} + +// DecodeHookExec executes the given decode hook. This should be used +// since it'll naturally degrade to the older backwards compatible DecodeHookFunc +// that took reflect.Kind instead of reflect.Type. +func DecodeHookExec( + raw DecodeHookFunc, + from reflect.Type, to reflect.Type, + data interface{}) (interface{}, error) { + switch f := typedDecodeHook(raw).(type) { + case DecodeHookFuncType: + return f(from, to, data) + case DecodeHookFuncKind: + return f(from.Kind(), to.Kind(), data) + default: + return nil, errors.New("invalid decode hook signature") + } +} + +// ComposeDecodeHookFunc creates a single DecodeHookFunc that +// automatically composes multiple DecodeHookFuncs. +// +// The composed funcs are called in order, with the result of the +// previous transformation. +func ComposeDecodeHookFunc(fs ...DecodeHookFunc) DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}) (interface{}, error) { + var err error + for _, f1 := range fs { + data, err = DecodeHookExec(f1, f, t, data) + if err != nil { + return nil, err + } + + // Modify the from kind to be correct with the new data + f = nil + if val := reflect.ValueOf(data); val.IsValid() { + f = val.Type() + } + } + + return data, nil + } +} + +// StringToSliceHookFunc returns a DecodeHookFunc that converts +// string to []string by splitting on the given sep. +func StringToSliceHookFunc(sep string) DecodeHookFunc { + return func( + f reflect.Kind, + t reflect.Kind, + data interface{}) (interface{}, error) { + if f != reflect.String || t != reflect.Slice { + return data, nil + } + + raw := data.(string) + if raw == "" { + return []string{}, nil + } + + return strings.Split(raw, sep), nil + } +} + +// StringToTimeDurationHookFunc returns a DecodeHookFunc that converts +// strings to time.Duration. +func StringToTimeDurationHookFunc() DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + if t != reflect.TypeOf(time.Duration(5)) { + return data, nil + } + + // Convert it by parsing + return time.ParseDuration(data.(string)) + } +} + +// WeaklyTypedHook is a DecodeHookFunc which adds support for weak typing to +// the decoder. +// +// Note that this is significantly different from the WeaklyTypedInput option +// of the DecoderConfig. +func WeaklyTypedHook( + f reflect.Kind, + t reflect.Kind, + data interface{}) (interface{}, error) { + dataVal := reflect.ValueOf(data) + switch t { + case reflect.String: + switch f { + case reflect.Bool: + if dataVal.Bool() { + return "1", nil + } + return "0", nil + case reflect.Float32: + return strconv.FormatFloat(dataVal.Float(), 'f', -1, 64), nil + case reflect.Int: + return strconv.FormatInt(dataVal.Int(), 10), nil + case reflect.Slice: + dataType := dataVal.Type() + elemKind := dataType.Elem().Kind() + if elemKind == reflect.Uint8 { + return string(dataVal.Interface().([]uint8)), nil + } + case reflect.Uint: + return strconv.FormatUint(dataVal.Uint(), 10), nil + } + } + + return data, nil +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/error.go b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/error.go new file mode 100644 index 0000000000..47a99e5af3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/error.go @@ -0,0 +1,50 @@ +package mapstructure + +import ( + "errors" + "fmt" + "sort" + "strings" +) + +// Error implements the error interface and can represents multiple +// errors that occur in the course of a single decode. +type Error struct { + Errors []string +} + +func (e *Error) Error() string { + points := make([]string, len(e.Errors)) + for i, err := range e.Errors { + points[i] = fmt.Sprintf("* %s", err) + } + + sort.Strings(points) + return fmt.Sprintf( + "%d error(s) decoding:\n\n%s", + len(e.Errors), strings.Join(points, "\n")) +} + +// WrappedErrors implements the errwrap.Wrapper interface to make this +// return value more useful with the errwrap and go-multierror libraries. +func (e *Error) WrappedErrors() []error { + if e == nil { + return nil + } + + result := make([]error, len(e.Errors)) + for i, e := range e.Errors { + result[i] = errors.New(e) + } + + return result +} + +func appendErrors(errors []string, err error) []string { + switch e := err.(type) { + case *Error: + return append(errors, e.Errors...) + default: + return append(errors, e.Error()) + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/mapstructure.go new file mode 100644 index 0000000000..6ec5c33357 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/mitchellh/mapstructure/mapstructure.go @@ -0,0 +1,828 @@ +// Package mapstructure exposes functionality to convert an arbitrary +// map[string]interface{} into a native Go structure. +// +// The Go structure can be arbitrarily complex, containing slices, +// other structs, etc. and the decoder will properly decode nested +// maps and so on into the proper structures in the native Go struct. +// See the examples to see what the decoder is capable of. +package mapstructure + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + "sort" + "strconv" + "strings" +) + +// DecodeHookFunc is the callback function that can be used for +// data transformations. See "DecodeHook" in the DecoderConfig +// struct. +// +// The type should be DecodeHookFuncType or DecodeHookFuncKind. +// Either is accepted. Types are a superset of Kinds (Types can return +// Kinds) and are generally a richer thing to use, but Kinds are simpler +// if you only need those. +// +// The reason DecodeHookFunc is multi-typed is for backwards compatibility: +// we started with Kinds and then realized Types were the better solution, +// but have a promise to not break backwards compat so we now support +// both. +type DecodeHookFunc interface{} + +// DecodeHookFuncType is a DecodeHookFunc which has complete information about +// the source and target types. +type DecodeHookFuncType func(reflect.Type, reflect.Type, interface{}) (interface{}, error) + +// DecodeHookFuncKind is a DecodeHookFunc which knows only the Kinds of the +// source and target types. +type DecodeHookFuncKind func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) + +// DecoderConfig is the configuration that is used to create a new decoder +// and allows customization of various aspects of decoding. +type DecoderConfig struct { + // DecodeHook, if set, will be called before any decoding and any + // type conversion (if WeaklyTypedInput is on). This lets you modify + // the values before they're set down onto the resulting struct. + // + // If an error is returned, the entire decode will fail with that + // error. + DecodeHook DecodeHookFunc + + // If ErrorUnused is true, then it is an error for there to exist + // keys in the original map that were unused in the decoding process + // (extra keys). + ErrorUnused bool + + // ZeroFields, if set to true, will zero fields before writing them. + // For example, a map will be emptied before decoded values are put in + // it. If this is false, a map will be merged. + ZeroFields bool + + // If WeaklyTypedInput is true, the decoder will make the following + // "weak" conversions: + // + // - bools to string (true = "1", false = "0") + // - numbers to string (base 10) + // - bools to int/uint (true = 1, false = 0) + // - strings to int/uint (base implied by prefix) + // - int to bool (true if value != 0) + // - string to bool (accepts: 1, t, T, TRUE, true, True, 0, f, F, + // FALSE, false, False. Anything else is an error) + // - empty array = empty map and vice versa + // - negative numbers to overflowed uint values (base 10) + // - slice of maps to a merged map + // - single values are converted to slices if required. Each + // element is weakly decoded. For example: "4" can become []int{4} + // if the target type is an int slice. + // + WeaklyTypedInput bool + + // Metadata is the struct that will contain extra metadata about + // the decoding. If this is nil, then no metadata will be tracked. + Metadata *Metadata + + // Result is a pointer to the struct that will contain the decoded + // value. + Result interface{} + + // The tag name that mapstructure reads for field names. This + // defaults to "mapstructure" + TagName string +} + +// A Decoder takes a raw interface value and turns it into structured +// data, keeping track of rich error information along the way in case +// anything goes wrong. Unlike the basic top-level Decode method, you can +// more finely control how the Decoder behaves using the DecoderConfig +// structure. The top-level Decode method is just a convenience that sets +// up the most basic Decoder. +type Decoder struct { + config *DecoderConfig +} + +// Metadata contains information about decoding a structure that +// is tedious or difficult to get otherwise. +type Metadata struct { + // Keys are the keys of the structure which were successfully decoded + Keys []string + + // Unused is a slice of keys that were found in the raw value but + // weren't decoded since there was no matching field in the result interface + Unused []string +} + +// Decode takes a map and uses reflection to convert it into the +// given Go native structure. val must be a pointer to a struct. +func Decode(m interface{}, rawVal interface{}) error { + config := &DecoderConfig{ + Metadata: nil, + Result: rawVal, + } + + decoder, err := NewDecoder(config) + if err != nil { + return err + } + + return decoder.Decode(m) +} + +// WeakDecode is the same as Decode but is shorthand to enable +// WeaklyTypedInput. See DecoderConfig for more info. +func WeakDecode(input, output interface{}) error { + config := &DecoderConfig{ + Metadata: nil, + Result: output, + WeaklyTypedInput: true, + } + + decoder, err := NewDecoder(config) + if err != nil { + return err + } + + return decoder.Decode(input) +} + +// NewDecoder returns a new decoder for the given configuration. Once +// a decoder has been returned, the same configuration must not be used +// again. +func NewDecoder(config *DecoderConfig) (*Decoder, error) { + val := reflect.ValueOf(config.Result) + if val.Kind() != reflect.Ptr { + return nil, errors.New("result must be a pointer") + } + + val = val.Elem() + if !val.CanAddr() { + return nil, errors.New("result must be addressable (a pointer)") + } + + if config.Metadata != nil { + if config.Metadata.Keys == nil { + config.Metadata.Keys = make([]string, 0) + } + + if config.Metadata.Unused == nil { + config.Metadata.Unused = make([]string, 0) + } + } + + if config.TagName == "" { + config.TagName = "mapstructure" + } + + result := &Decoder{ + config: config, + } + + return result, nil +} + +// Decode decodes the given raw interface to the target pointer specified +// by the configuration. +func (d *Decoder) Decode(raw interface{}) error { + return d.decode("", raw, reflect.ValueOf(d.config.Result).Elem()) +} + +// Decodes an unknown data type into a specific reflection value. +func (d *Decoder) decode(name string, data interface{}, val reflect.Value) error { + if data == nil { + // If the data is nil, then we don't set anything. + return nil + } + + dataVal := reflect.ValueOf(data) + if !dataVal.IsValid() { + // If the data value is invalid, then we just set the value + // to be the zero value. + val.Set(reflect.Zero(val.Type())) + return nil + } + + if d.config.DecodeHook != nil { + // We have a DecodeHook, so let's pre-process the data. + var err error + data, err = DecodeHookExec( + d.config.DecodeHook, + dataVal.Type(), val.Type(), data) + if err != nil { + return fmt.Errorf("error decoding '%s': %s", name, err) + } + } + + var err error + dataKind := getKind(val) + switch dataKind { + case reflect.Bool: + err = d.decodeBool(name, data, val) + case reflect.Interface: + err = d.decodeBasic(name, data, val) + case reflect.String: + err = d.decodeString(name, data, val) + case reflect.Int: + err = d.decodeInt(name, data, val) + case reflect.Uint: + err = d.decodeUint(name, data, val) + case reflect.Float32: + err = d.decodeFloat(name, data, val) + case reflect.Struct: + err = d.decodeStruct(name, data, val) + case reflect.Map: + err = d.decodeMap(name, data, val) + case reflect.Ptr: + err = d.decodePtr(name, data, val) + case reflect.Slice: + err = d.decodeSlice(name, data, val) + case reflect.Func: + err = d.decodeFunc(name, data, val) + default: + // If we reached this point then we weren't able to decode it + return fmt.Errorf("%s: unsupported type: %s", name, dataKind) + } + + // If we reached here, then we successfully decoded SOMETHING, so + // mark the key as used if we're tracking metadata. + if d.config.Metadata != nil && name != "" { + d.config.Metadata.Keys = append(d.config.Metadata.Keys, name) + } + + return err +} + +// This decodes a basic type (bool, int, string, etc.) and sets the +// value to "data" of that type. +func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.ValueOf(data) + if !dataVal.IsValid() { + dataVal = reflect.Zero(val.Type()) + } + + dataValType := dataVal.Type() + if !dataValType.AssignableTo(val.Type()) { + return fmt.Errorf( + "'%s' expected type '%s', got '%s'", + name, val.Type(), dataValType) + } + + val.Set(dataVal) + return nil +} + +func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.ValueOf(data) + dataKind := getKind(dataVal) + + converted := true + switch { + case dataKind == reflect.String: + val.SetString(dataVal.String()) + case dataKind == reflect.Bool && d.config.WeaklyTypedInput: + if dataVal.Bool() { + val.SetString("1") + } else { + val.SetString("0") + } + case dataKind == reflect.Int && d.config.WeaklyTypedInput: + val.SetString(strconv.FormatInt(dataVal.Int(), 10)) + case dataKind == reflect.Uint && d.config.WeaklyTypedInput: + val.SetString(strconv.FormatUint(dataVal.Uint(), 10)) + case dataKind == reflect.Float32 && d.config.WeaklyTypedInput: + val.SetString(strconv.FormatFloat(dataVal.Float(), 'f', -1, 64)) + case dataKind == reflect.Slice && d.config.WeaklyTypedInput: + dataType := dataVal.Type() + elemKind := dataType.Elem().Kind() + switch { + case elemKind == reflect.Uint8: + val.SetString(string(dataVal.Interface().([]uint8))) + default: + converted = false + } + default: + converted = false + } + + if !converted { + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s'", + name, val.Type(), dataVal.Type()) + } + + return nil +} + +func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.ValueOf(data) + dataKind := getKind(dataVal) + dataType := dataVal.Type() + + switch { + case dataKind == reflect.Int: + val.SetInt(dataVal.Int()) + case dataKind == reflect.Uint: + val.SetInt(int64(dataVal.Uint())) + case dataKind == reflect.Float32: + val.SetInt(int64(dataVal.Float())) + case dataKind == reflect.Bool && d.config.WeaklyTypedInput: + if dataVal.Bool() { + val.SetInt(1) + } else { + val.SetInt(0) + } + case dataKind == reflect.String && d.config.WeaklyTypedInput: + i, err := strconv.ParseInt(dataVal.String(), 0, val.Type().Bits()) + if err == nil { + val.SetInt(i) + } else { + return fmt.Errorf("cannot parse '%s' as int: %s", name, err) + } + case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number": + jn := data.(json.Number) + i, err := jn.Int64() + if err != nil { + return fmt.Errorf( + "error decoding json.Number into %s: %s", name, err) + } + val.SetInt(i) + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s'", + name, val.Type(), dataVal.Type()) + } + + return nil +} + +func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.ValueOf(data) + dataKind := getKind(dataVal) + + switch { + case dataKind == reflect.Int: + i := dataVal.Int() + if i < 0 && !d.config.WeaklyTypedInput { + return fmt.Errorf("cannot parse '%s', %d overflows uint", + name, i) + } + val.SetUint(uint64(i)) + case dataKind == reflect.Uint: + val.SetUint(dataVal.Uint()) + case dataKind == reflect.Float32: + f := dataVal.Float() + if f < 0 && !d.config.WeaklyTypedInput { + return fmt.Errorf("cannot parse '%s', %f overflows uint", + name, f) + } + val.SetUint(uint64(f)) + case dataKind == reflect.Bool && d.config.WeaklyTypedInput: + if dataVal.Bool() { + val.SetUint(1) + } else { + val.SetUint(0) + } + case dataKind == reflect.String && d.config.WeaklyTypedInput: + i, err := strconv.ParseUint(dataVal.String(), 0, val.Type().Bits()) + if err == nil { + val.SetUint(i) + } else { + return fmt.Errorf("cannot parse '%s' as uint: %s", name, err) + } + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s'", + name, val.Type(), dataVal.Type()) + } + + return nil +} + +func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.ValueOf(data) + dataKind := getKind(dataVal) + + switch { + case dataKind == reflect.Bool: + val.SetBool(dataVal.Bool()) + case dataKind == reflect.Int && d.config.WeaklyTypedInput: + val.SetBool(dataVal.Int() != 0) + case dataKind == reflect.Uint && d.config.WeaklyTypedInput: + val.SetBool(dataVal.Uint() != 0) + case dataKind == reflect.Float32 && d.config.WeaklyTypedInput: + val.SetBool(dataVal.Float() != 0) + case dataKind == reflect.String && d.config.WeaklyTypedInput: + b, err := strconv.ParseBool(dataVal.String()) + if err == nil { + val.SetBool(b) + } else if dataVal.String() == "" { + val.SetBool(false) + } else { + return fmt.Errorf("cannot parse '%s' as bool: %s", name, err) + } + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s'", + name, val.Type(), dataVal.Type()) + } + + return nil +} + +func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.ValueOf(data) + dataKind := getKind(dataVal) + dataType := dataVal.Type() + + switch { + case dataKind == reflect.Int: + val.SetFloat(float64(dataVal.Int())) + case dataKind == reflect.Uint: + val.SetFloat(float64(dataVal.Uint())) + case dataKind == reflect.Float32: + val.SetFloat(dataVal.Float()) + case dataKind == reflect.Bool && d.config.WeaklyTypedInput: + if dataVal.Bool() { + val.SetFloat(1) + } else { + val.SetFloat(0) + } + case dataKind == reflect.String && d.config.WeaklyTypedInput: + f, err := strconv.ParseFloat(dataVal.String(), val.Type().Bits()) + if err == nil { + val.SetFloat(f) + } else { + return fmt.Errorf("cannot parse '%s' as float: %s", name, err) + } + case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number": + jn := data.(json.Number) + i, err := jn.Float64() + if err != nil { + return fmt.Errorf( + "error decoding json.Number into %s: %s", name, err) + } + val.SetFloat(i) + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s'", + name, val.Type(), dataVal.Type()) + } + + return nil +} + +func (d *Decoder) decodeMap(name string, data interface{}, val reflect.Value) error { + valType := val.Type() + valKeyType := valType.Key() + valElemType := valType.Elem() + + // By default we overwrite keys in the current map + valMap := val + + // If the map is nil or we're purposely zeroing fields, make a new map + if valMap.IsNil() || d.config.ZeroFields { + // Make a new map to hold our result + mapType := reflect.MapOf(valKeyType, valElemType) + valMap = reflect.MakeMap(mapType) + } + + // Check input type + dataVal := reflect.Indirect(reflect.ValueOf(data)) + if dataVal.Kind() != reflect.Map { + // In weak mode, we accept a slice of maps as an input... + if d.config.WeaklyTypedInput { + switch dataVal.Kind() { + case reflect.Array, reflect.Slice: + // Special case for BC reasons (covered by tests) + if dataVal.Len() == 0 { + val.Set(valMap) + return nil + } + + for i := 0; i < dataVal.Len(); i++ { + err := d.decode( + fmt.Sprintf("%s[%d]", name, i), + dataVal.Index(i).Interface(), val) + if err != nil { + return err + } + } + + return nil + } + } + + return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind()) + } + + // Accumulate errors + errors := make([]string, 0) + + for _, k := range dataVal.MapKeys() { + fieldName := fmt.Sprintf("%s[%s]", name, k) + + // First decode the key into the proper type + currentKey := reflect.Indirect(reflect.New(valKeyType)) + if err := d.decode(fieldName, k.Interface(), currentKey); err != nil { + errors = appendErrors(errors, err) + continue + } + + // Next decode the data into the proper type + v := dataVal.MapIndex(k).Interface() + currentVal := reflect.Indirect(reflect.New(valElemType)) + if err := d.decode(fieldName, v, currentVal); err != nil { + errors = appendErrors(errors, err) + continue + } + + valMap.SetMapIndex(currentKey, currentVal) + } + + // Set the built up map to the value + val.Set(valMap) + + // If we had errors, return those + if len(errors) > 0 { + return &Error{errors} + } + + return nil +} + +func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) error { + // Create an element of the concrete (non pointer) type and decode + // into that. Then set the value of the pointer to this type. + valType := val.Type() + valElemType := valType.Elem() + + realVal := val + if realVal.IsNil() || d.config.ZeroFields { + realVal = reflect.New(valElemType) + } + + if err := d.decode(name, data, reflect.Indirect(realVal)); err != nil { + return err + } + + val.Set(realVal) + return nil +} + +func (d *Decoder) decodeFunc(name string, data interface{}, val reflect.Value) error { + // Create an element of the concrete (non pointer) type and decode + // into that. Then set the value of the pointer to this type. + dataVal := reflect.Indirect(reflect.ValueOf(data)) + if val.Type() != dataVal.Type() { + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s'", + name, val.Type(), dataVal.Type()) + } + val.Set(dataVal) + return nil +} + +func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataValKind := dataVal.Kind() + valType := val.Type() + valElemType := valType.Elem() + sliceType := reflect.SliceOf(valElemType) + + valSlice := val + if valSlice.IsNil() || d.config.ZeroFields { + // Check input type + if dataValKind != reflect.Array && dataValKind != reflect.Slice { + if d.config.WeaklyTypedInput { + switch { + // Empty maps turn into empty slices + case dataValKind == reflect.Map: + if dataVal.Len() == 0 { + val.Set(reflect.MakeSlice(sliceType, 0, 0)) + return nil + } + + // All other types we try to convert to the slice type + // and "lift" it into it. i.e. a string becomes a string slice. + default: + // Just re-try this function with data as a slice. + return d.decodeSlice(name, []interface{}{data}, val) + } + } + + return fmt.Errorf( + "'%s': source data must be an array or slice, got %s", name, dataValKind) + + } + + // Make a new slice to hold our result, same size as the original data. + valSlice = reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len()) + } + + // Accumulate any errors + errors := make([]string, 0) + + for i := 0; i < dataVal.Len(); i++ { + currentData := dataVal.Index(i).Interface() + for valSlice.Len() <= i { + valSlice = reflect.Append(valSlice, reflect.Zero(valElemType)) + } + currentField := valSlice.Index(i) + + fieldName := fmt.Sprintf("%s[%d]", name, i) + if err := d.decode(fieldName, currentData, currentField); err != nil { + errors = appendErrors(errors, err) + } + } + + // Finally, set the value to the slice we built up + val.Set(valSlice) + + // If there were errors, we return those + if len(errors) > 0 { + return &Error{errors} + } + + return nil +} + +func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + + // If the type of the value to write to and the data match directly, + // then we just set it directly instead of recursing into the structure. + if dataVal.Type() == val.Type() { + val.Set(dataVal) + return nil + } + + dataValKind := dataVal.Kind() + if dataValKind != reflect.Map { + return fmt.Errorf("'%s' expected a map, got '%s'", name, dataValKind) + } + + dataValType := dataVal.Type() + if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface { + return fmt.Errorf( + "'%s' needs a map with string keys, has '%s' keys", + name, dataValType.Key().Kind()) + } + + dataValKeys := make(map[reflect.Value]struct{}) + dataValKeysUnused := make(map[interface{}]struct{}) + for _, dataValKey := range dataVal.MapKeys() { + dataValKeys[dataValKey] = struct{}{} + dataValKeysUnused[dataValKey.Interface()] = struct{}{} + } + + errors := make([]string, 0) + + // This slice will keep track of all the structs we'll be decoding. + // There can be more than one struct if there are embedded structs + // that are squashed. + structs := make([]reflect.Value, 1, 5) + structs[0] = val + + // Compile the list of all the fields that we're going to be decoding + // from all the structs. + fields := make(map[*reflect.StructField]reflect.Value) + for len(structs) > 0 { + structVal := structs[0] + structs = structs[1:] + + structType := structVal.Type() + + for i := 0; i < structType.NumField(); i++ { + fieldType := structType.Field(i) + fieldKind := fieldType.Type.Kind() + + // If "squash" is specified in the tag, we squash the field down. + squash := false + tagParts := strings.Split(fieldType.Tag.Get(d.config.TagName), ",") + for _, tag := range tagParts[1:] { + if tag == "squash" { + squash = true + break + } + } + + if squash { + if fieldKind != reflect.Struct { + errors = appendErrors(errors, + fmt.Errorf("%s: unsupported type for squash: %s", fieldType.Name, fieldKind)) + } else { + structs = append(structs, val.FieldByName(fieldType.Name)) + } + continue + } + + // Normal struct field, store it away + fields[&fieldType] = structVal.Field(i) + } + } + + for fieldType, field := range fields { + fieldName := fieldType.Name + + tagValue := fieldType.Tag.Get(d.config.TagName) + tagValue = strings.SplitN(tagValue, ",", 2)[0] + if tagValue != "" { + fieldName = tagValue + } + + rawMapKey := reflect.ValueOf(fieldName) + rawMapVal := dataVal.MapIndex(rawMapKey) + if !rawMapVal.IsValid() { + // Do a slower search by iterating over each key and + // doing case-insensitive search. + for dataValKey := range dataValKeys { + mK, ok := dataValKey.Interface().(string) + if !ok { + // Not a string key + continue + } + + if strings.EqualFold(mK, fieldName) { + rawMapKey = dataValKey + rawMapVal = dataVal.MapIndex(dataValKey) + break + } + } + + if !rawMapVal.IsValid() { + // There was no matching key in the map for the value in + // the struct. Just ignore. + continue + } + } + + // Delete the key we're using from the unused map so we stop tracking + delete(dataValKeysUnused, rawMapKey.Interface()) + + if !field.IsValid() { + // This should never happen + panic("field is not valid") + } + + // If we can't set the field, then it is unexported or something, + // and we just continue onwards. + if !field.CanSet() { + continue + } + + // If the name is empty string, then we're at the root, and we + // don't dot-join the fields. + if name != "" { + fieldName = fmt.Sprintf("%s.%s", name, fieldName) + } + + if err := d.decode(fieldName, rawMapVal.Interface(), field); err != nil { + errors = appendErrors(errors, err) + } + } + + if d.config.ErrorUnused && len(dataValKeysUnused) > 0 { + keys := make([]string, 0, len(dataValKeysUnused)) + for rawKey := range dataValKeysUnused { + keys = append(keys, rawKey.(string)) + } + sort.Strings(keys) + + err := fmt.Errorf("'%s' has invalid keys: %s", name, strings.Join(keys, ", ")) + errors = appendErrors(errors, err) + } + + if len(errors) > 0 { + return &Error{errors} + } + + // Add the unused keys to the list of unused keys if we're tracking metadata + if d.config.Metadata != nil { + for rawKey := range dataValKeysUnused { + key := rawKey.(string) + if name != "" { + key = fmt.Sprintf("%s.%s", name, key) + } + + d.config.Metadata.Unused = append(d.config.Metadata.Unused, key) + } + } + + return nil +} + +func getKind(val reflect.Value) reflect.Kind { + kind := val.Kind() + + switch { + case kind >= reflect.Int && kind <= reflect.Int64: + return reflect.Int + case kind >= reflect.Uint && kind <= reflect.Uint64: + return reflect.Uint + case kind >= reflect.Float32 && kind <= reflect.Float64: + return reflect.Float32 + default: + return kind + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/CHANGELOG.md b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/CHANGELOG.md new file mode 100644 index 0000000000..6a4ab3f14b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/CHANGELOG.md @@ -0,0 +1,156 @@ +## HEAD + +- When using custom reporters register the custom reporters *before* the default reporter. This allows users to see the output of any print statements in their customer reporters. [#365] + +## 1.4.0 7/16/2017 + +- `ginkgo` now provides a hint if you accidentally forget to run `ginkgo bootstrap` to generate a `*_suite_test.go` file that actually invokes the Ginkgo test runner. [#345](https://github.com/onsi/ginkgo/pull/345) +- thanks to improvements in `go test -c` `ginkgo` no longer needs to fix Go's compilation output to ensure compilation errors are expressed relative to the CWD. [#357] +- `ginkgo watch -watchRegExp=...` allows you to specify a custom regular expression to watch. Only files matching the regular expression are watched for changes (the default is `\.go$`) [#356] +- `ginkgo` now always emits compilation output. Previously, only failed compilation output was printed out. [#277] +- `ginkgo -requireSuite` now fails the test run if there are `*_test.go` files but `go test` fails to detect any tests. Typically this means you forgot to run `ginkgo bootstrap` to generate a suite file. [#344] +- `ginkgo -timeout=DURATION` allows you to adjust the timeout for the entire test suite (default is 24 hours) [#248] + +## 1.3.0 3/28/2017 + +Improvements: + +- Significantly improved parallel test distribution. Now instead of pre-sharding test cases across workers (which can result in idle workers and poor test performance) Ginkgo uses a shared queue to keep all workers busy until all tests are complete. This improves test-time performance and consistency. +- `Skip(message)` can be used to skip the current test. +- Added `extensions/table` - a Ginkgo DSL for [Table Driven Tests](http://onsi.github.io/ginkgo/#table-driven-tests) +- Add `GinkgoRandomSeed()` - shorthand for `config.GinkgoConfig.RandomSeed` +- Support for retrying flaky tests with `--flakeAttempts` +- `ginkgo ./...` now recurses as you'd expect +- Added `Specify` a synonym for `It` +- Support colorise on Windows +- Broader support for various go compilation flags in the `ginkgo` CLI + +Bug Fixes: + +- Ginkgo tests now fail when you `panic(nil)` (#167) + +## 1.2.0 5/31/2015 + +Improvements + +- `ginkgo -coverpkg` calls down to `go test -coverpkg` (#160) +- `ginkgo -afterSuiteHook COMMAND` invokes the passed-in `COMMAND` after a test suite completes (#152) +- Relaxed requirement for Go 1.4+. `ginkgo` now works with Go v1.3+ (#166) + +## 1.2.0-beta + +Ginkgo now requires Go 1.4+ + +Improvements: + +- Call reporters in reverse order when announcing spec completion -- allows custom reporters to emit output before the default reporter does. +- Improved focus behavior. Now, this: + + ```golang + FDescribe("Some describe", func() { + It("A", func() {}) + + FIt("B", func() {}) + }) + ``` + + will run `B` but *not* `A`. This tends to be a common usage pattern when in the thick of writing and debugging tests. +- When `SIGINT` is received, Ginkgo will emit the contents of the `GinkgoWriter` before running the `AfterSuite`. Useful for debugging stuck tests. +- When `--progress` is set, Ginkgo will write test progress (in particular, Ginkgo will say when it is about to run a BeforeEach, AfterEach, It, etc...) to the `GinkgoWriter`. This is useful for debugging stuck tests and tests that generate many logs. +- Improved output when an error occurs in a setup or teardown block. +- When `--dryRun` is set, Ginkgo will walk the spec tree and emit to its reporter *without* actually running anything. Best paired with `-v` to understand which specs will run in which order. +- Add `By` to help document long `It`s. `By` simply writes to the `GinkgoWriter`. +- Add support for precompiled tests: + - `ginkgo build ` will now compile the package, producing a file named `package.test` + - The compiled `package.test` file can be run directly. This runs the tests in series. + - To run precompiled tests in parallel, you can run: `ginkgo -p package.test` +- Support `bootstrap`ping and `generate`ing [Agouti](http://agouti.org) specs. +- `ginkgo generate` and `ginkgo bootstrap` now honor the package name already defined in a given directory +- The `ginkgo` CLI ignores `SIGQUIT`. Prevents its stack dump from interlacing with the underlying test suite's stack dump. +- The `ginkgo` CLI now compiles tests into a temporary directory instead of the package directory. This necessitates upgrading to Go v1.4+. +- `ginkgo -notify` now works on Linux + +Bug Fixes: + +- If --skipPackages is used and all packages are skipped, Ginkgo should exit 0. +- Fix tempfile leak when running in parallel +- Fix incorrect failure message when a panic occurs during a parallel test run +- Fixed an issue where a pending test within a focused context (or a focused test within a pending context) would skip all other tests. +- Be more consistent about handling SIGTERM as well as SIGINT +- When interupted while concurrently compiling test suites in the background, Ginkgo now cleans up the compiled artifacts. +- Fixed a long standing bug where `ginkgo -p` would hang if a process spawned by one of the Ginkgo parallel nodes does not exit. (Hooray!) + +## 1.1.0 (8/2/2014) + +No changes, just dropping the beta. + +## 1.1.0-beta (7/22/2014) +New Features: + +- `ginkgo watch` now monitors packages *and their dependencies* for changes. The depth of the dependency tree can be modified with the `-depth` flag. +- Test suites with a programmatic focus (`FIt`, `FDescribe`, etc...) exit with non-zero status code, even when they pass. This allows CI systems to detect accidental commits of focused test suites. +- `ginkgo -p` runs the testsuite in parallel with an auto-detected number of nodes. +- `ginkgo -tags=TAG_LIST` passes a list of tags down to the `go build` command. +- `ginkgo --failFast` aborts the test suite after the first failure. +- `ginkgo generate file_1 file_2` can take multiple file arguments. +- Ginkgo now summarizes any spec failures that occured at the end of the test run. +- `ginkgo --randomizeSuites` will run tests *suites* in random order using the generated/passed-in seed. + +Improvements: + +- `ginkgo -skipPackage` now takes a comma-separated list of strings. If the *relative path* to a package matches one of the entries in the comma-separated list, that package is skipped. +- `ginkgo --untilItFails` no longer recompiles between attempts. +- Ginkgo now panics when a runnable node (`It`, `BeforeEach`, `JustBeforeEach`, `AfterEach`, `Measure`) is nested within another runnable node. This is always a mistake. Any test suites that panic because of this change should be fixed. + +Bug Fixes: + +- `ginkgo boostrap` and `ginkgo generate` no longer fail when dealing with `hyphen-separated-packages`. +- parallel specs are now better distributed across nodes - fixed a crashing bug where (for example) distributing 11 tests across 7 nodes would panic + +## 1.0.0 (5/24/2014) +New Features: + +- Add `GinkgoParallelNode()` - shorthand for `config.GinkgoConfig.ParallelNode` + +Improvements: + +- When compilation fails, the compilation output is rewritten to present a correct *relative* path. Allows ⌘-clicking in iTerm open the file in your text editor. +- `--untilItFails` and `ginkgo watch` now generate new random seeds between test runs, unless a particular random seed is specified. + +Bug Fixes: + +- `-cover` now generates a correctly combined coverprofile when running with in parallel with multiple `-node`s. +- Print out the contents of the `GinkgoWriter` when `BeforeSuite` or `AfterSuite` fail. +- Fix all remaining race conditions in Ginkgo's test suite. + +## 1.0.0-beta (4/14/2014) +Breaking changes: + +- `thirdparty/gomocktestreporter` is gone. Use `GinkgoT()` instead +- Modified the Reporter interface +- `watch` is now a subcommand, not a flag. + +DSL changes: + +- `BeforeSuite` and `AfterSuite` for setting up and tearing down test suites. +- `AfterSuite` is triggered on interrupt (`^C`) as well as exit. +- `SynchronizedBeforeSuite` and `SynchronizedAfterSuite` for setting up and tearing down singleton resources across parallel nodes. + +CLI changes: + +- `watch` is now a subcommand, not a flag +- `--nodot` flag can be passed to `ginkgo generate` and `ginkgo bootstrap` to avoid dot imports. This explicitly imports all exported identifiers in Ginkgo and Gomega. Refreshing this list can be done by running `ginkgo nodot` +- Additional arguments can be passed to specs. Pass them after the `--` separator +- `--skipPackage` flag takes a regexp and ignores any packages with package names passing said regexp. +- `--trace` flag prints out full stack traces when errors occur, not just the line at which the error occurs. + +Misc: + +- Start using semantic versioning +- Start maintaining changelog + +Major refactor: + +- Pull out Ginkgo's internal to `internal` +- Rename `example` everywhere to `spec` +- Much more! diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/CONTRIBUTING.md b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/CONTRIBUTING.md new file mode 100644 index 0000000000..bc0c54fe2b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/CONTRIBUTING.md @@ -0,0 +1,12 @@ +# Contributing to Ginkgo + +Your contributions to Ginkgo are essential for its long-term maintenance and improvement. To make a contribution: + +- Please **open an issue first** - describe what problem you are trying to solve and give the community a forum for input and feedback ahead of investing time in writing code! +- Ensure adequate test coverage: + - If you're adding functionality to the Ginkgo library, make sure to add appropriate unit and/or integration tests (under the `integration` folder). + - If you're adding functionality to the Ginkgo CLI note that there are very few unit tests. Please add an integration test. + - Please run all tests locally (`ginkgo -r -p`) and make sure they go green before submitting the PR +- Update the documentation. In addition to standard `godoc` comments Ginkgo has extensive documentation on the `gh-pages` branch. If relevant, please submit a docs PR to that branch alongside your code PR. + +Thanks for supporting Ginkgo! \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/LICENSE b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/LICENSE new file mode 100644 index 0000000000..9415ee72c1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013-2014 Onsi Fakhouri + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/README.md b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/README.md new file mode 100644 index 0000000000..97e9cdc426 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/README.md @@ -0,0 +1,123 @@ +![Ginkgo: A Golang BDD Testing Framework](http://onsi.github.io/ginkgo/images/ginkgo.png) + +[![Build Status](https://travis-ci.org/onsi/ginkgo.svg)](https://travis-ci.org/onsi/ginkgo) + +Jump to the [docs](http://onsi.github.io/ginkgo/) to learn more. To start rolling your Ginkgo tests *now* [keep reading](#set-me-up)! + +If you have a question, comment, bug report, feature request, etc. please open a GitHub issue. + +## Feature List + +- Ginkgo uses Go's `testing` package and can live alongside your existing `testing` tests. It's easy to [bootstrap](http://onsi.github.io/ginkgo/#bootstrapping-a-suite) and start writing your [first tests](http://onsi.github.io/ginkgo/#adding-specs-to-a-suite) + +- Structure your BDD-style tests expressively: + - Nestable [`Describe` and `Context` container blocks](http://onsi.github.io/ginkgo/#organizing-specs-with-containers-describe-and-context) + - [`BeforeEach` and `AfterEach` blocks](http://onsi.github.io/ginkgo/#extracting-common-setup-beforeeach) for setup and teardown + - [`It` blocks](http://onsi.github.io/ginkgo/#individual-specs-) that hold your assertions + - [`JustBeforeEach` blocks](http://onsi.github.io/ginkgo/#separating-creation-and-configuration-justbeforeeach) that separate creation from configuration (also known as the subject action pattern). + - [`BeforeSuite` and `AfterSuite` blocks](http://onsi.github.io/ginkgo/#global-setup-and-teardown-beforesuite-and-aftersuite) to prep for and cleanup after a suite. + +- A comprehensive test runner that lets you: + - Mark specs as [pending](http://onsi.github.io/ginkgo/#pending-specs) + - [Focus](http://onsi.github.io/ginkgo/#focused-specs) individual specs, and groups of specs, either programmatically or on the command line + - Run your tests in [random order](http://onsi.github.io/ginkgo/#spec-permutation), and then reuse random seeds to replicate the same order. + - Break up your test suite into parallel processes for straightforward [test parallelization](http://onsi.github.io/ginkgo/#parallel-specs) + +- `ginkgo`: a command line interface with plenty of handy command line arguments for [running your tests](http://onsi.github.io/ginkgo/#running-tests) and [generating](http://onsi.github.io/ginkgo/#generators) test files. Here are a few choice examples: + - `ginkgo -nodes=N` runs your tests in `N` parallel processes and print out coherent output in realtime + - `ginkgo -cover` runs your tests using Golang's code coverage tool + - `ginkgo convert` converts an XUnit-style `testing` package to a Ginkgo-style package + - `ginkgo -focus="REGEXP"` and `ginkgo -skip="REGEXP"` allow you to specify a subset of tests to run via regular expression + - `ginkgo -r` runs all tests suites under the current directory + - `ginkgo -v` prints out identifying information for each tests just before it runs + + And much more: run `ginkgo help` for details! + + The `ginkgo` CLI is convenient, but purely optional -- Ginkgo works just fine with `go test` + +- `ginkgo watch` [watches](https://onsi.github.io/ginkgo/#watching-for-changes) packages *and their dependencies* for changes, then reruns tests. Run tests immediately as you develop! + +- Built-in support for testing [asynchronicity](http://onsi.github.io/ginkgo/#asynchronous-tests) + +- Built-in support for [benchmarking](http://onsi.github.io/ginkgo/#benchmark-tests) your code. Control the number of benchmark samples as you gather runtimes and other, arbitrary, bits of numerical information about your code. + +- [Completions for Sublime Text](https://github.com/onsi/ginkgo-sublime-completions): just use [Package Control](https://sublime.wbond.net/) to install `Ginkgo Completions`. + +- [Completions for VSCode](https://github.com/onsi/vscode-ginkgo): just use VSCode's extension installer to install `vscode-ginkgo`. + +- Straightforward support for third-party testing libraries such as [Gomock](https://code.google.com/p/gomock/) and [Testify](https://github.com/stretchr/testify). Check out the [docs](http://onsi.github.io/ginkgo/#third-party-integrations) for details. + +- A modular architecture that lets you easily: + - Write [custom reporters](http://onsi.github.io/ginkgo/#writing-custom-reporters) (for example, Ginkgo comes with a [JUnit XML reporter](http://onsi.github.io/ginkgo/#generating-junit-xml-output) and a TeamCity reporter). + - [Adapt an existing matcher library (or write your own!)](http://onsi.github.io/ginkgo/#using-other-matcher-libraries) to work with Ginkgo + +## [Gomega](http://github.com/onsi/gomega): Ginkgo's Preferred Matcher Library + +Ginkgo is best paired with Gomega. Learn more about Gomega [here](http://onsi.github.io/gomega/) + +## [Agouti](http://github.com/sclevine/agouti): A Golang Acceptance Testing Framework + +Agouti allows you run WebDriver integration tests. Learn more about Agouti [here](http://agouti.org) + +## Set Me Up! + +You'll need Golang v1.3+ (Ubuntu users: you probably have Golang v1.0 -- you'll need to upgrade!) + +```bash + +go get github.com/onsi/ginkgo/ginkgo # installs the ginkgo CLI +go get github.com/onsi/gomega # fetches the matcher library + +cd path/to/package/you/want/to/test + +ginkgo bootstrap # set up a new ginkgo suite +ginkgo generate # will create a sample test file. edit this file and add your tests then... + +go test # to run your tests + +ginkgo # also runs your tests + +``` + +## I'm new to Go: What are my testing options? + +Of course, I heartily recommend [Ginkgo](https://github.com/onsi/ginkgo) and [Gomega](https://github.com/onsi/gomega). Both packages are seeing heavy, daily, production use on a number of projects and boast a mature and comprehensive feature-set. + +With that said, it's great to know what your options are :) + +### What Golang gives you out of the box + +Testing is a first class citizen in Golang, however Go's built-in testing primitives are somewhat limited: The [testing](http://golang.org/pkg/testing) package provides basic XUnit style tests and no assertion library. + +### Matcher libraries for Golang's XUnit style tests + +A number of matcher libraries have been written to augment Go's built-in XUnit style tests. Here are two that have gained traction: + +- [testify](https://github.com/stretchr/testify) +- [gocheck](http://labix.org/gocheck) + +You can also use Ginkgo's matcher library [Gomega](https://github.com/onsi/gomega) in [XUnit style tests](http://onsi.github.io/gomega/#using-gomega-with-golangs-xunitstyle-tests) + +### BDD style testing frameworks + +There are a handful of BDD-style testing frameworks written for Golang. Here are a few: + +- [Ginkgo](https://github.com/onsi/ginkgo) ;) +- [GoConvey](https://github.com/smartystreets/goconvey) +- [Goblin](https://github.com/franela/goblin) +- [Mao](https://github.com/azer/mao) +- [Zen](https://github.com/pranavraja/zen) + +Finally, @shageman has [put together](https://github.com/shageman/gotestit) a comprehensive comparison of golang testing libraries. + +Go explore! + +## License + +Ginkgo is MIT-Licensed + +## Contributing + +Since Ginkgo tests also internal packages, when you fork, you'll have to replace imports with your repository.
+Use `before_pr.sh` for that
+After you finished your changes and before you push your pull request, use `after_pr.sh` to revert those changes \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/before_pr.sh b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/before_pr.sh new file mode 100755 index 0000000000..3cf262f388 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/before_pr.sh @@ -0,0 +1,13 @@ +# Take current path +path=$(pwd) + +# Split it +IFS='\/'; arrIN=($path); unset IFS; + +# Find directory before ginkgo +len=${#arrIN[@]} + +userDir=${arrIN[$len-2]} + +# Replace onsi with userdir +find . -type f -name '*.go' -exec sed -i '' s/github.com\\/onsi\\/ginkgo\\/internal/github.com\\/$userDir\\/ginkgo\\/internal/ {} + \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/config/config.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/config/config.go new file mode 100644 index 0000000000..60d5ea22e8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/config/config.go @@ -0,0 +1,187 @@ +/* +Ginkgo accepts a number of configuration options. + +These are documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) + +You can also learn more via + + ginkgo help + +or (I kid you not): + + go test -asdf +*/ +package config + +import ( + "flag" + "time" + + "fmt" +) + +const VERSION = "1.4.0" + +type GinkgoConfigType struct { + RandomSeed int64 + RandomizeAllSpecs bool + RegexScansFilePath bool + FocusString string + SkipString string + SkipMeasurements bool + FailOnPending bool + FailFast bool + FlakeAttempts int + EmitSpecProgress bool + DryRun bool + + ParallelNode int + ParallelTotal int + SyncHost string + StreamHost string +} + +var GinkgoConfig = GinkgoConfigType{} + +type DefaultReporterConfigType struct { + NoColor bool + SlowSpecThreshold float64 + NoisyPendings bool + Succinct bool + Verbose bool + FullTrace bool +} + +var DefaultReporterConfig = DefaultReporterConfigType{} + +func processPrefix(prefix string) string { + if prefix != "" { + prefix = prefix + "." + } + return prefix +} + +func Flags(flagSet *flag.FlagSet, prefix string, includeParallelFlags bool) { + prefix = processPrefix(prefix) + flagSet.Int64Var(&(GinkgoConfig.RandomSeed), prefix+"seed", time.Now().Unix(), "The seed used to randomize the spec suite.") + flagSet.BoolVar(&(GinkgoConfig.RandomizeAllSpecs), prefix+"randomizeAllSpecs", false, "If set, ginkgo will randomize all specs together. By default, ginkgo only randomizes the top level Describe/Context groups.") + flagSet.BoolVar(&(GinkgoConfig.SkipMeasurements), prefix+"skipMeasurements", false, "If set, ginkgo will skip any measurement specs.") + flagSet.BoolVar(&(GinkgoConfig.FailOnPending), prefix+"failOnPending", false, "If set, ginkgo will mark the test suite as failed if any specs are pending.") + flagSet.BoolVar(&(GinkgoConfig.FailFast), prefix+"failFast", false, "If set, ginkgo will stop running a test suite after a failure occurs.") + + flagSet.BoolVar(&(GinkgoConfig.DryRun), prefix+"dryRun", false, "If set, ginkgo will walk the test hierarchy without actually running anything. Best paired with -v.") + + flagSet.StringVar(&(GinkgoConfig.FocusString), prefix+"focus", "", "If set, ginkgo will only run specs that match this regular expression.") + flagSet.StringVar(&(GinkgoConfig.SkipString), prefix+"skip", "", "If set, ginkgo will only run specs that do not match this regular expression.") + + flagSet.BoolVar(&(GinkgoConfig.RegexScansFilePath), prefix+"regexScansFilePath", false, "If set, ginkgo regex matching also will look at the file path (code location).") + + flagSet.IntVar(&(GinkgoConfig.FlakeAttempts), prefix+"flakeAttempts", 1, "Make up to this many attempts to run each spec. Please note that if any of the attempts succeed, the suite will not be failed. But any failures will still be recorded.") + + flagSet.BoolVar(&(GinkgoConfig.EmitSpecProgress), prefix+"progress", false, "If set, ginkgo will emit progress information as each spec runs to the GinkgoWriter.") + + if includeParallelFlags { + flagSet.IntVar(&(GinkgoConfig.ParallelNode), prefix+"parallel.node", 1, "This worker node's (one-indexed) node number. For running specs in parallel.") + flagSet.IntVar(&(GinkgoConfig.ParallelTotal), prefix+"parallel.total", 1, "The total number of worker nodes. For running specs in parallel.") + flagSet.StringVar(&(GinkgoConfig.SyncHost), prefix+"parallel.synchost", "", "The address for the server that will synchronize the running nodes.") + flagSet.StringVar(&(GinkgoConfig.StreamHost), prefix+"parallel.streamhost", "", "The address for the server that the running nodes should stream data to.") + } + + flagSet.BoolVar(&(DefaultReporterConfig.NoColor), prefix+"noColor", false, "If set, suppress color output in default reporter.") + flagSet.Float64Var(&(DefaultReporterConfig.SlowSpecThreshold), prefix+"slowSpecThreshold", 5.0, "(in seconds) Specs that take longer to run than this threshold are flagged as slow by the default reporter.") + flagSet.BoolVar(&(DefaultReporterConfig.NoisyPendings), prefix+"noisyPendings", true, "If set, default reporter will shout about pending tests.") + flagSet.BoolVar(&(DefaultReporterConfig.Verbose), prefix+"v", false, "If set, default reporter print out all specs as they begin.") + flagSet.BoolVar(&(DefaultReporterConfig.Succinct), prefix+"succinct", false, "If set, default reporter prints out a very succinct report") + flagSet.BoolVar(&(DefaultReporterConfig.FullTrace), prefix+"trace", false, "If set, default reporter prints out the full stack trace when a failure occurs") +} + +func BuildFlagArgs(prefix string, ginkgo GinkgoConfigType, reporter DefaultReporterConfigType) []string { + prefix = processPrefix(prefix) + result := make([]string, 0) + + if ginkgo.RandomSeed > 0 { + result = append(result, fmt.Sprintf("--%sseed=%d", prefix, ginkgo.RandomSeed)) + } + + if ginkgo.RandomizeAllSpecs { + result = append(result, fmt.Sprintf("--%srandomizeAllSpecs", prefix)) + } + + if ginkgo.SkipMeasurements { + result = append(result, fmt.Sprintf("--%sskipMeasurements", prefix)) + } + + if ginkgo.FailOnPending { + result = append(result, fmt.Sprintf("--%sfailOnPending", prefix)) + } + + if ginkgo.FailFast { + result = append(result, fmt.Sprintf("--%sfailFast", prefix)) + } + + if ginkgo.DryRun { + result = append(result, fmt.Sprintf("--%sdryRun", prefix)) + } + + if ginkgo.FocusString != "" { + result = append(result, fmt.Sprintf("--%sfocus=%s", prefix, ginkgo.FocusString)) + } + + if ginkgo.SkipString != "" { + result = append(result, fmt.Sprintf("--%sskip=%s", prefix, ginkgo.SkipString)) + } + + if ginkgo.FlakeAttempts > 1 { + result = append(result, fmt.Sprintf("--%sflakeAttempts=%d", prefix, ginkgo.FlakeAttempts)) + } + + if ginkgo.EmitSpecProgress { + result = append(result, fmt.Sprintf("--%sprogress", prefix)) + } + + if ginkgo.ParallelNode != 0 { + result = append(result, fmt.Sprintf("--%sparallel.node=%d", prefix, ginkgo.ParallelNode)) + } + + if ginkgo.ParallelTotal != 0 { + result = append(result, fmt.Sprintf("--%sparallel.total=%d", prefix, ginkgo.ParallelTotal)) + } + + if ginkgo.StreamHost != "" { + result = append(result, fmt.Sprintf("--%sparallel.streamhost=%s", prefix, ginkgo.StreamHost)) + } + + if ginkgo.SyncHost != "" { + result = append(result, fmt.Sprintf("--%sparallel.synchost=%s", prefix, ginkgo.SyncHost)) + } + + if ginkgo.RegexScansFilePath { + result = append(result, fmt.Sprintf("--%sregexScansFilePath", prefix)) + } + + if reporter.NoColor { + result = append(result, fmt.Sprintf("--%snoColor", prefix)) + } + + if reporter.SlowSpecThreshold > 0 { + result = append(result, fmt.Sprintf("--%sslowSpecThreshold=%.5f", prefix, reporter.SlowSpecThreshold)) + } + + if !reporter.NoisyPendings { + result = append(result, fmt.Sprintf("--%snoisyPendings=false", prefix)) + } + + if reporter.Verbose { + result = append(result, fmt.Sprintf("--%sv", prefix)) + } + + if reporter.Succinct { + result = append(result, fmt.Sprintf("--%ssuccinct", prefix)) + } + + if reporter.FullTrace { + result = append(result, fmt.Sprintf("--%strace", prefix)) + } + + return result +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go new file mode 100644 index 0000000000..de6757c9f6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go @@ -0,0 +1,569 @@ +/* +Ginkgo is a BDD-style testing framework for Golang + +The godoc documentation describes Ginkgo's API. More comprehensive documentation (with examples!) is available at http://onsi.github.io/ginkgo/ + +Ginkgo's preferred matcher library is [Gomega](http://github.com/onsi/gomega) + +Ginkgo on Github: http://github.com/onsi/ginkgo + +Ginkgo is MIT-Licensed +*/ +package ginkgo + +import ( + "flag" + "fmt" + "io" + "net/http" + "os" + "strings" + "time" + + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/internal/codelocation" + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/internal/remote" + "github.com/onsi/ginkgo/internal/suite" + "github.com/onsi/ginkgo/internal/testingtproxy" + "github.com/onsi/ginkgo/internal/writer" + "github.com/onsi/ginkgo/reporters" + "github.com/onsi/ginkgo/reporters/stenographer" + "github.com/onsi/ginkgo/types" +) + +const GINKGO_VERSION = config.VERSION +const GINKGO_PANIC = ` +Your test failed. +Ginkgo panics to prevent subsequent assertions from running. +Normally Ginkgo rescues this panic so you shouldn't see it. + +But, if you make an assertion in a goroutine, Ginkgo can't capture the panic. +To circumvent this, you should call + + defer GinkgoRecover() + +at the top of the goroutine that caused this panic. +` +const defaultTimeout = 1 + +var globalSuite *suite.Suite +var globalFailer *failer.Failer + +func init() { + config.Flags(flag.CommandLine, "ginkgo", true) + GinkgoWriter = writer.New(os.Stdout) + globalFailer = failer.New() + globalSuite = suite.New(globalFailer) +} + +//GinkgoWriter implements an io.Writer +//When running in verbose mode any writes to GinkgoWriter will be immediately printed +//to stdout. Otherwise, GinkgoWriter will buffer any writes produced during the current test and flush them to screen +//only if the current test fails. +var GinkgoWriter io.Writer + +//The interface by which Ginkgo receives *testing.T +type GinkgoTestingT interface { + Fail() +} + +//GinkgoRandomSeed returns the seed used to randomize spec execution order. It is +//useful for seeding your own pseudorandom number generators (PRNGs) to ensure +//consistent executions from run to run, where your tests contain variability (for +//example, when selecting random test data). +func GinkgoRandomSeed() int64 { + return config.GinkgoConfig.RandomSeed +} + +//GinkgoParallelNode returns the parallel node number for the current ginkgo process +//The node number is 1-indexed +func GinkgoParallelNode() int { + return config.GinkgoConfig.ParallelNode +} + +//Some matcher libraries or legacy codebases require a *testing.T +//GinkgoT implements an interface analogous to *testing.T and can be used if +//the library in question accepts *testing.T through an interface +// +// For example, with testify: +// assert.Equal(GinkgoT(), 123, 123, "they should be equal") +// +// Or with gomock: +// gomock.NewController(GinkgoT()) +// +// GinkgoT() takes an optional offset argument that can be used to get the +// correct line number associated with the failure. +func GinkgoT(optionalOffset ...int) GinkgoTInterface { + offset := 3 + if len(optionalOffset) > 0 { + offset = optionalOffset[0] + } + return testingtproxy.New(GinkgoWriter, Fail, offset) +} + +//The interface returned by GinkgoT(). This covers most of the methods +//in the testing package's T. +type GinkgoTInterface interface { + Fail() + Error(args ...interface{}) + Errorf(format string, args ...interface{}) + FailNow() + Fatal(args ...interface{}) + Fatalf(format string, args ...interface{}) + Log(args ...interface{}) + Logf(format string, args ...interface{}) + Failed() bool + Parallel() + Skip(args ...interface{}) + Skipf(format string, args ...interface{}) + SkipNow() + Skipped() bool +} + +//Custom Ginkgo test reporters must implement the Reporter interface. +// +//The custom reporter is passed in a SuiteSummary when the suite begins and ends, +//and a SpecSummary just before a spec begins and just after a spec ends +type Reporter reporters.Reporter + +//Asynchronous specs are given a channel of the Done type. You must close or write to the channel +//to tell Ginkgo that your async test is done. +type Done chan<- interface{} + +//GinkgoTestDescription represents the information about the current running test returned by CurrentGinkgoTestDescription +// FullTestText: a concatenation of ComponentTexts and the TestText +// ComponentTexts: a list of all texts for the Describes & Contexts leading up to the current test +// TestText: the text in the actual It or Measure node +// IsMeasurement: true if the current test is a measurement +// FileName: the name of the file containing the current test +// LineNumber: the line number for the current test +// Failed: if the current test has failed, this will be true (useful in an AfterEach) +type GinkgoTestDescription struct { + FullTestText string + ComponentTexts []string + TestText string + + IsMeasurement bool + + FileName string + LineNumber int + + Failed bool +} + +//CurrentGinkgoTestDescripton returns information about the current running test. +func CurrentGinkgoTestDescription() GinkgoTestDescription { + summary, ok := globalSuite.CurrentRunningSpecSummary() + if !ok { + return GinkgoTestDescription{} + } + + subjectCodeLocation := summary.ComponentCodeLocations[len(summary.ComponentCodeLocations)-1] + + return GinkgoTestDescription{ + ComponentTexts: summary.ComponentTexts[1:], + FullTestText: strings.Join(summary.ComponentTexts[1:], " "), + TestText: summary.ComponentTexts[len(summary.ComponentTexts)-1], + IsMeasurement: summary.IsMeasurement, + FileName: subjectCodeLocation.FileName, + LineNumber: subjectCodeLocation.LineNumber, + Failed: summary.HasFailureState(), + } +} + +//Measurement tests receive a Benchmarker. +// +//You use the Time() function to time how long the passed in body function takes to run +//You use the RecordValue() function to track arbitrary numerical measurements. +//The RecordValueWithPrecision() function can be used alternatively to provide the unit +//and resolution of the numeric measurement. +//The optional info argument is passed to the test reporter and can be used to +// provide the measurement data to a custom reporter with context. +// +//See http://onsi.github.io/ginkgo/#benchmark_tests for more details +type Benchmarker interface { + Time(name string, body func(), info ...interface{}) (elapsedTime time.Duration) + RecordValue(name string, value float64, info ...interface{}) + RecordValueWithPrecision(name string, value float64, units string, precision int, info ...interface{}) +} + +//RunSpecs is the entry point for the Ginkgo test runner. +//You must call this within a Golang testing TestX(t *testing.T) function. +// +//To bootstrap a test suite you can use the Ginkgo CLI: +// +// ginkgo bootstrap +func RunSpecs(t GinkgoTestingT, description string) bool { + specReporters := []Reporter{buildDefaultReporter()} + return RunSpecsWithCustomReporters(t, description, specReporters) +} + +//To run your tests with Ginkgo's default reporter and your custom reporter(s), replace +//RunSpecs() with this method. +func RunSpecsWithDefaultAndCustomReporters(t GinkgoTestingT, description string, specReporters []Reporter) bool { + specReporters = append(specReporters, buildDefaultReporter()) + return RunSpecsWithCustomReporters(t, description, specReporters) +} + +//To run your tests with your custom reporter(s) (and *not* Ginkgo's default reporter), replace +//RunSpecs() with this method. Note that parallel tests will not work correctly without the default reporter +func RunSpecsWithCustomReporters(t GinkgoTestingT, description string, specReporters []Reporter) bool { + writer := GinkgoWriter.(*writer.Writer) + writer.SetStream(config.DefaultReporterConfig.Verbose) + reporters := make([]reporters.Reporter, len(specReporters)) + for i, reporter := range specReporters { + reporters[i] = reporter + } + passed, hasFocusedTests := globalSuite.Run(t, description, reporters, writer, config.GinkgoConfig) + if passed && hasFocusedTests { + fmt.Println("PASS | FOCUSED") + os.Exit(types.GINKGO_FOCUS_EXIT_CODE) + } + return passed +} + +func buildDefaultReporter() Reporter { + remoteReportingServer := config.GinkgoConfig.StreamHost + if remoteReportingServer == "" { + stenographer := stenographer.New(!config.DefaultReporterConfig.NoColor, config.GinkgoConfig.FlakeAttempts > 1) + return reporters.NewDefaultReporter(config.DefaultReporterConfig, stenographer) + } else { + return remote.NewForwardingReporter(remoteReportingServer, &http.Client{}, remote.NewOutputInterceptor()) + } +} + +//Skip notifies Ginkgo that the current spec should be skipped. +func Skip(message string, callerSkip ...int) { + skip := 0 + if len(callerSkip) > 0 { + skip = callerSkip[0] + } + + globalFailer.Skip(message, codelocation.New(skip+1)) + panic(GINKGO_PANIC) +} + +//Fail notifies Ginkgo that the current spec has failed. (Gomega will call Fail for you automatically when an assertion fails.) +func Fail(message string, callerSkip ...int) { + skip := 0 + if len(callerSkip) > 0 { + skip = callerSkip[0] + } + + globalFailer.Fail(message, codelocation.New(skip+1)) + panic(GINKGO_PANIC) +} + +//GinkgoRecover should be deferred at the top of any spawned goroutine that (may) call `Fail` +//Since Gomega assertions call fail, you should throw a `defer GinkgoRecover()` at the top of any goroutine that +//calls out to Gomega +// +//Here's why: Ginkgo's `Fail` method records the failure and then panics to prevent +//further assertions from running. This panic must be recovered. Ginkgo does this for you +//if the panic originates in a Ginkgo node (an It, BeforeEach, etc...) +// +//Unfortunately, if a panic originates on a goroutine *launched* from one of these nodes there's no +//way for Ginkgo to rescue the panic. To do this, you must remember to `defer GinkgoRecover()` at the top of such a goroutine. +func GinkgoRecover() { + e := recover() + if e != nil { + globalFailer.Panic(codelocation.New(1), e) + } +} + +//Describe blocks allow you to organize your specs. A Describe block can contain any number of +//BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks. +// +//In addition you can nest Describe and Context blocks. Describe and Context blocks are functionally +//equivalent. The difference is purely semantic -- you typical Describe the behavior of an object +//or method and, within that Describe, outline a number of Contexts. +func Describe(text string, body func()) bool { + globalSuite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1)) + return true +} + +//You can focus the tests within a describe block using FDescribe +func FDescribe(text string, body func()) bool { + globalSuite.PushContainerNode(text, body, types.FlagTypeFocused, codelocation.New(1)) + return true +} + +//You can mark the tests within a describe block as pending using PDescribe +func PDescribe(text string, body func()) bool { + globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) + return true +} + +//You can mark the tests within a describe block as pending using XDescribe +func XDescribe(text string, body func()) bool { + globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) + return true +} + +//Context blocks allow you to organize your specs. A Context block can contain any number of +//BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks. +// +//In addition you can nest Describe and Context blocks. Describe and Context blocks are functionally +//equivalent. The difference is purely semantic -- you typical Describe the behavior of an object +//or method and, within that Describe, outline a number of Contexts. +func Context(text string, body func()) bool { + globalSuite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1)) + return true +} + +//You can focus the tests within a describe block using FContext +func FContext(text string, body func()) bool { + globalSuite.PushContainerNode(text, body, types.FlagTypeFocused, codelocation.New(1)) + return true +} + +//You can mark the tests within a describe block as pending using PContext +func PContext(text string, body func()) bool { + globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) + return true +} + +//You can mark the tests within a describe block as pending using XContext +func XContext(text string, body func()) bool { + globalSuite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) + return true +} + +//It blocks contain your test code and assertions. You cannot nest any other Ginkgo blocks +//within an It block. +// +//Ginkgo will normally run It blocks synchronously. To perform asynchronous tests, pass a +//function that accepts a Done channel. When you do this, you can also provide an optional timeout. +func It(text string, body interface{}, timeout ...float64) bool { + globalSuite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...)) + return true +} + +//You can focus individual Its using FIt +func FIt(text string, body interface{}, timeout ...float64) bool { + globalSuite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...)) + return true +} + +//You can mark Its as pending using PIt +func PIt(text string, _ ...interface{}) bool { + globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) + return true +} + +//You can mark Its as pending using XIt +func XIt(text string, _ ...interface{}) bool { + globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) + return true +} + +//Specify blocks are aliases for It blocks and allow for more natural wording in situations +//which "It" does not fit into a natural sentence flow. All the same protocols apply for Specify blocks +//which apply to It blocks. +func Specify(text string, body interface{}, timeout ...float64) bool { + return It(text, body, timeout...) +} + +//You can focus individual Specifys using FSpecify +func FSpecify(text string, body interface{}, timeout ...float64) bool { + return FIt(text, body, timeout...) +} + +//You can mark Specifys as pending using PSpecify +func PSpecify(text string, is ...interface{}) bool { + return PIt(text, is...) +} + +//You can mark Specifys as pending using XSpecify +func XSpecify(text string, is ...interface{}) bool { + return XIt(text, is...) +} + +//By allows you to better document large Its. +// +//Generally you should try to keep your Its short and to the point. This is not always possible, however, +//especially in the context of integration tests that capture a particular workflow. +// +//By allows you to document such flows. By must be called within a runnable node (It, BeforeEach, Measure, etc...) +//By will simply log the passed in text to the GinkgoWriter. If By is handed a function it will immediately run the function. +func By(text string, callbacks ...func()) { + preamble := "\x1b[1mSTEP\x1b[0m" + if config.DefaultReporterConfig.NoColor { + preamble = "STEP" + } + fmt.Fprintln(GinkgoWriter, preamble+": "+text) + if len(callbacks) == 1 { + callbacks[0]() + } + if len(callbacks) > 1 { + panic("just one callback per By, please") + } +} + +//Measure blocks run the passed in body function repeatedly (determined by the samples argument) +//and accumulate metrics provided to the Benchmarker by the body function. +// +//The body function must have the signature: +// func(b Benchmarker) +func Measure(text string, body interface{}, samples int) bool { + globalSuite.PushMeasureNode(text, body, types.FlagTypeNone, codelocation.New(1), samples) + return true +} + +//You can focus individual Measures using FMeasure +func FMeasure(text string, body interface{}, samples int) bool { + globalSuite.PushMeasureNode(text, body, types.FlagTypeFocused, codelocation.New(1), samples) + return true +} + +//You can mark Maeasurements as pending using PMeasure +func PMeasure(text string, _ ...interface{}) bool { + globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) + return true +} + +//You can mark Maeasurements as pending using XMeasure +func XMeasure(text string, _ ...interface{}) bool { + globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) + return true +} + +//BeforeSuite blocks are run just once before any specs are run. When running in parallel, each +//parallel node process will call BeforeSuite. +// +//BeforeSuite blocks can be made asynchronous by providing a body function that accepts a Done channel +// +//You may only register *one* BeforeSuite handler per test suite. You typically do so in your bootstrap file at the top level. +func BeforeSuite(body interface{}, timeout ...float64) bool { + globalSuite.SetBeforeSuiteNode(body, codelocation.New(1), parseTimeout(timeout...)) + return true +} + +//AfterSuite blocks are *always* run after all the specs regardless of whether specs have passed or failed. +//Moreover, if Ginkgo receives an interrupt signal (^C) it will attempt to run the AfterSuite before exiting. +// +//When running in parallel, each parallel node process will call AfterSuite. +// +//AfterSuite blocks can be made asynchronous by providing a body function that accepts a Done channel +// +//You may only register *one* AfterSuite handler per test suite. You typically do so in your bootstrap file at the top level. +func AfterSuite(body interface{}, timeout ...float64) bool { + globalSuite.SetAfterSuiteNode(body, codelocation.New(1), parseTimeout(timeout...)) + return true +} + +//SynchronizedBeforeSuite blocks are primarily meant to solve the problem of setting up singleton external resources shared across +//nodes when running tests in parallel. For example, say you have a shared database that you can only start one instance of that +//must be used in your tests. When running in parallel, only one node should set up the database and all other nodes should wait +//until that node is done before running. +// +//SynchronizedBeforeSuite accomplishes this by taking *two* function arguments. The first is only run on parallel node #1. The second is +//run on all nodes, but *only* after the first function completes succesfully. Ginkgo also makes it possible to send data from the first function (on Node 1) +//to the second function (on all the other nodes). +// +//The functions have the following signatures. The first function (which only runs on node 1) has the signature: +// +// func() []byte +// +//or, to run asynchronously: +// +// func(done Done) []byte +// +//The byte array returned by the first function is then passed to the second function, which has the signature: +// +// func(data []byte) +// +//or, to run asynchronously: +// +// func(data []byte, done Done) +// +//Here's a simple pseudo-code example that starts a shared database on Node 1 and shares the database's address with the other nodes: +// +// var dbClient db.Client +// var dbRunner db.Runner +// +// var _ = SynchronizedBeforeSuite(func() []byte { +// dbRunner = db.NewRunner() +// err := dbRunner.Start() +// Ω(err).ShouldNot(HaveOccurred()) +// return []byte(dbRunner.URL) +// }, func(data []byte) { +// dbClient = db.NewClient() +// err := dbClient.Connect(string(data)) +// Ω(err).ShouldNot(HaveOccurred()) +// }) +func SynchronizedBeforeSuite(node1Body interface{}, allNodesBody interface{}, timeout ...float64) bool { + globalSuite.SetSynchronizedBeforeSuiteNode( + node1Body, + allNodesBody, + codelocation.New(1), + parseTimeout(timeout...), + ) + return true +} + +//SynchronizedAfterSuite blocks complement the SynchronizedBeforeSuite blocks in solving the problem of setting up +//external singleton resources shared across nodes when running tests in parallel. +// +//SynchronizedAfterSuite accomplishes this by taking *two* function arguments. The first runs on all nodes. The second runs only on parallel node #1 +//and *only* after all other nodes have finished and exited. This ensures that node 1, and any resources it is running, remain alive until +//all other nodes are finished. +// +//Both functions have the same signature: either func() or func(done Done) to run asynchronously. +// +//Here's a pseudo-code example that complements that given in SynchronizedBeforeSuite. Here, SynchronizedAfterSuite is used to tear down the shared database +//only after all nodes have finished: +// +// var _ = SynchronizedAfterSuite(func() { +// dbClient.Cleanup() +// }, func() { +// dbRunner.Stop() +// }) +func SynchronizedAfterSuite(allNodesBody interface{}, node1Body interface{}, timeout ...float64) bool { + globalSuite.SetSynchronizedAfterSuiteNode( + allNodesBody, + node1Body, + codelocation.New(1), + parseTimeout(timeout...), + ) + return true +} + +//BeforeEach blocks are run before It blocks. When multiple BeforeEach blocks are defined in nested +//Describe and Context blocks the outermost BeforeEach blocks are run first. +// +//Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts +//a Done channel +func BeforeEach(body interface{}, timeout ...float64) bool { + globalSuite.PushBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...)) + return true +} + +//JustBeforeEach blocks are run before It blocks but *after* all BeforeEach blocks. For more details, +//read the [documentation](http://onsi.github.io/ginkgo/#separating_creation_and_configuration_) +// +//Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts +//a Done channel +func JustBeforeEach(body interface{}, timeout ...float64) bool { + globalSuite.PushJustBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...)) + return true +} + +//AfterEach blocks are run after It blocks. When multiple AfterEach blocks are defined in nested +//Describe and Context blocks the innermost AfterEach blocks are run first. +// +//Like It blocks, AfterEach blocks can be made asynchronous by providing a body function that accepts +//a Done channel +func AfterEach(body interface{}, timeout ...float64) bool { + globalSuite.PushAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...)) + return true +} + +func parseTimeout(timeout ...float64) time.Duration { + if len(timeout) == 0 { + return time.Duration(defaultTimeout * int64(time.Second)) + } else { + return time.Duration(timeout[0] * float64(time.Second)) + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go new file mode 100644 index 0000000000..fa2f0bf730 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go @@ -0,0 +1,32 @@ +package codelocation + +import ( + "regexp" + "runtime" + "runtime/debug" + "strings" + + "github.com/onsi/ginkgo/types" +) + +func New(skip int) types.CodeLocation { + _, file, line, _ := runtime.Caller(skip + 1) + stackTrace := PruneStack(string(debug.Stack()), skip) + return types.CodeLocation{FileName: file, LineNumber: line, FullStackTrace: stackTrace} +} + +func PruneStack(fullStackTrace string, skip int) string { + stack := strings.Split(fullStackTrace, "\n") + if len(stack) > 2*(skip+1) { + stack = stack[2*(skip+1):] + } + prunedStack := []string{} + re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) + for i := 0; i < len(stack)/2; i++ { + if !re.Match([]byte(stack[i*2])) { + prunedStack = append(prunedStack, stack[i*2]) + prunedStack = append(prunedStack, stack[i*2+1]) + } + } + return strings.Join(prunedStack, "\n") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/containernode/container_node.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/containernode/container_node.go new file mode 100644 index 0000000000..0737746dcf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/containernode/container_node.go @@ -0,0 +1,151 @@ +package containernode + +import ( + "math/rand" + "sort" + + "github.com/onsi/ginkgo/internal/leafnodes" + "github.com/onsi/ginkgo/types" +) + +type subjectOrContainerNode struct { + containerNode *ContainerNode + subjectNode leafnodes.SubjectNode +} + +func (n subjectOrContainerNode) text() string { + if n.containerNode != nil { + return n.containerNode.Text() + } else { + return n.subjectNode.Text() + } +} + +type CollatedNodes struct { + Containers []*ContainerNode + Subject leafnodes.SubjectNode +} + +type ContainerNode struct { + text string + flag types.FlagType + codeLocation types.CodeLocation + + setupNodes []leafnodes.BasicNode + subjectAndContainerNodes []subjectOrContainerNode +} + +func New(text string, flag types.FlagType, codeLocation types.CodeLocation) *ContainerNode { + return &ContainerNode{ + text: text, + flag: flag, + codeLocation: codeLocation, + } +} + +func (container *ContainerNode) Shuffle(r *rand.Rand) { + sort.Sort(container) + permutation := r.Perm(len(container.subjectAndContainerNodes)) + shuffledNodes := make([]subjectOrContainerNode, len(container.subjectAndContainerNodes)) + for i, j := range permutation { + shuffledNodes[i] = container.subjectAndContainerNodes[j] + } + container.subjectAndContainerNodes = shuffledNodes +} + +func (node *ContainerNode) BackPropagateProgrammaticFocus() bool { + if node.flag == types.FlagTypePending { + return false + } + + shouldUnfocus := false + for _, subjectOrContainerNode := range node.subjectAndContainerNodes { + if subjectOrContainerNode.containerNode != nil { + shouldUnfocus = subjectOrContainerNode.containerNode.BackPropagateProgrammaticFocus() || shouldUnfocus + } else { + shouldUnfocus = (subjectOrContainerNode.subjectNode.Flag() == types.FlagTypeFocused) || shouldUnfocus + } + } + + if shouldUnfocus { + if node.flag == types.FlagTypeFocused { + node.flag = types.FlagTypeNone + } + return true + } + + return node.flag == types.FlagTypeFocused +} + +func (node *ContainerNode) Collate() []CollatedNodes { + return node.collate([]*ContainerNode{}) +} + +func (node *ContainerNode) collate(enclosingContainers []*ContainerNode) []CollatedNodes { + collated := make([]CollatedNodes, 0) + + containers := make([]*ContainerNode, len(enclosingContainers)) + copy(containers, enclosingContainers) + containers = append(containers, node) + + for _, subjectOrContainer := range node.subjectAndContainerNodes { + if subjectOrContainer.containerNode != nil { + collated = append(collated, subjectOrContainer.containerNode.collate(containers)...) + } else { + collated = append(collated, CollatedNodes{ + Containers: containers, + Subject: subjectOrContainer.subjectNode, + }) + } + } + + return collated +} + +func (node *ContainerNode) PushContainerNode(container *ContainerNode) { + node.subjectAndContainerNodes = append(node.subjectAndContainerNodes, subjectOrContainerNode{containerNode: container}) +} + +func (node *ContainerNode) PushSubjectNode(subject leafnodes.SubjectNode) { + node.subjectAndContainerNodes = append(node.subjectAndContainerNodes, subjectOrContainerNode{subjectNode: subject}) +} + +func (node *ContainerNode) PushSetupNode(setupNode leafnodes.BasicNode) { + node.setupNodes = append(node.setupNodes, setupNode) +} + +func (node *ContainerNode) SetupNodesOfType(nodeType types.SpecComponentType) []leafnodes.BasicNode { + nodes := []leafnodes.BasicNode{} + for _, setupNode := range node.setupNodes { + if setupNode.Type() == nodeType { + nodes = append(nodes, setupNode) + } + } + return nodes +} + +func (node *ContainerNode) Text() string { + return node.text +} + +func (node *ContainerNode) CodeLocation() types.CodeLocation { + return node.codeLocation +} + +func (node *ContainerNode) Flag() types.FlagType { + return node.flag +} + +//sort.Interface + +func (node *ContainerNode) Len() int { + return len(node.subjectAndContainerNodes) +} + +func (node *ContainerNode) Less(i, j int) bool { + return node.subjectAndContainerNodes[i].text() < node.subjectAndContainerNodes[j].text() +} + +func (node *ContainerNode) Swap(i, j int) { + node.subjectAndContainerNodes[i], node.subjectAndContainerNodes[j] = node.subjectAndContainerNodes[j], node.subjectAndContainerNodes[i] +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/failer/failer.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/failer/failer.go new file mode 100644 index 0000000000..678ea2514a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/failer/failer.go @@ -0,0 +1,92 @@ +package failer + +import ( + "fmt" + "sync" + + "github.com/onsi/ginkgo/types" +) + +type Failer struct { + lock *sync.Mutex + failure types.SpecFailure + state types.SpecState +} + +func New() *Failer { + return &Failer{ + lock: &sync.Mutex{}, + state: types.SpecStatePassed, + } +} + +func (f *Failer) Panic(location types.CodeLocation, forwardedPanic interface{}) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.state == types.SpecStatePassed { + f.state = types.SpecStatePanicked + f.failure = types.SpecFailure{ + Message: "Test Panicked", + Location: location, + ForwardedPanic: fmt.Sprintf("%v", forwardedPanic), + } + } +} + +func (f *Failer) Timeout(location types.CodeLocation) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.state == types.SpecStatePassed { + f.state = types.SpecStateTimedOut + f.failure = types.SpecFailure{ + Message: "Timed out", + Location: location, + } + } +} + +func (f *Failer) Fail(message string, location types.CodeLocation) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.state == types.SpecStatePassed { + f.state = types.SpecStateFailed + f.failure = types.SpecFailure{ + Message: message, + Location: location, + } + } +} + +func (f *Failer) Drain(componentType types.SpecComponentType, componentIndex int, componentCodeLocation types.CodeLocation) (types.SpecFailure, types.SpecState) { + f.lock.Lock() + defer f.lock.Unlock() + + failure := f.failure + outcome := f.state + if outcome != types.SpecStatePassed { + failure.ComponentType = componentType + failure.ComponentIndex = componentIndex + failure.ComponentCodeLocation = componentCodeLocation + } + + f.state = types.SpecStatePassed + f.failure = types.SpecFailure{} + + return failure, outcome +} + +func (f *Failer) Skip(message string, location types.CodeLocation) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.state == types.SpecStatePassed { + f.state = types.SpecStateSkipped + f.failure = types.SpecFailure{ + Message: message, + Location: location, + } + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/benchmarker.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/benchmarker.go new file mode 100644 index 0000000000..9c3eed2b6f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/benchmarker.go @@ -0,0 +1,103 @@ +package leafnodes + +import ( + "math" + "time" + + "sync" + + "github.com/onsi/ginkgo/types" +) + +type benchmarker struct { + mu sync.Mutex + measurements map[string]*types.SpecMeasurement + orderCounter int +} + +func newBenchmarker() *benchmarker { + return &benchmarker{ + measurements: make(map[string]*types.SpecMeasurement, 0), + } +} + +func (b *benchmarker) Time(name string, body func(), info ...interface{}) (elapsedTime time.Duration) { + t := time.Now() + body() + elapsedTime = time.Since(t) + + b.mu.Lock() + defer b.mu.Unlock() + measurement := b.getMeasurement(name, "Fastest Time", "Slowest Time", "Average Time", "s", 3, info...) + measurement.Results = append(measurement.Results, elapsedTime.Seconds()) + + return +} + +func (b *benchmarker) RecordValue(name string, value float64, info ...interface{}) { + measurement := b.getMeasurement(name, "Smallest", " Largest", " Average", "", 3, info...) + b.mu.Lock() + defer b.mu.Unlock() + measurement.Results = append(measurement.Results, value) +} + +func (b *benchmarker) RecordValueWithPrecision(name string, value float64, units string, precision int, info ...interface{}) { + measurement := b.getMeasurement(name, "Smallest", " Largest", " Average", units, precision, info...) + b.mu.Lock() + defer b.mu.Unlock() + measurement.Results = append(measurement.Results, value) +} + +func (b *benchmarker) getMeasurement(name string, smallestLabel string, largestLabel string, averageLabel string, units string, precision int, info ...interface{}) *types.SpecMeasurement { + measurement, ok := b.measurements[name] + if !ok { + var computedInfo interface{} + computedInfo = nil + if len(info) > 0 { + computedInfo = info[0] + } + measurement = &types.SpecMeasurement{ + Name: name, + Info: computedInfo, + Order: b.orderCounter, + SmallestLabel: smallestLabel, + LargestLabel: largestLabel, + AverageLabel: averageLabel, + Units: units, + Precision: precision, + Results: make([]float64, 0), + } + b.measurements[name] = measurement + b.orderCounter++ + } + + return measurement +} + +func (b *benchmarker) measurementsReport() map[string]*types.SpecMeasurement { + b.mu.Lock() + defer b.mu.Unlock() + for _, measurement := range b.measurements { + measurement.Smallest = math.MaxFloat64 + measurement.Largest = -math.MaxFloat64 + sum := float64(0) + sumOfSquares := float64(0) + + for _, result := range measurement.Results { + if result > measurement.Largest { + measurement.Largest = result + } + if result < measurement.Smallest { + measurement.Smallest = result + } + sum += result + sumOfSquares += result * result + } + + n := float64(len(measurement.Results)) + measurement.Average = sum / n + measurement.StdDeviation = math.Sqrt(sumOfSquares/n - (sum/n)*(sum/n)) + } + + return b.measurements +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/interfaces.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/interfaces.go new file mode 100644 index 0000000000..8c3902d601 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/interfaces.go @@ -0,0 +1,19 @@ +package leafnodes + +import ( + "github.com/onsi/ginkgo/types" +) + +type BasicNode interface { + Type() types.SpecComponentType + Run() (types.SpecState, types.SpecFailure) + CodeLocation() types.CodeLocation +} + +type SubjectNode interface { + BasicNode + + Text() string + Flag() types.FlagType + Samples() int +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/it_node.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/it_node.go new file mode 100644 index 0000000000..c76fe3a451 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/it_node.go @@ -0,0 +1,46 @@ +package leafnodes + +import ( + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/types" + "time" +) + +type ItNode struct { + runner *runner + + flag types.FlagType + text string +} + +func NewItNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *ItNode { + return &ItNode{ + runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeIt, componentIndex), + flag: flag, + text: text, + } +} + +func (node *ItNode) Run() (outcome types.SpecState, failure types.SpecFailure) { + return node.runner.run() +} + +func (node *ItNode) Type() types.SpecComponentType { + return types.SpecComponentTypeIt +} + +func (node *ItNode) Text() string { + return node.text +} + +func (node *ItNode) Flag() types.FlagType { + return node.flag +} + +func (node *ItNode) CodeLocation() types.CodeLocation { + return node.runner.codeLocation +} + +func (node *ItNode) Samples() int { + return 1 +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/measure_node.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/measure_node.go new file mode 100644 index 0000000000..efc3348c1b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/measure_node.go @@ -0,0 +1,61 @@ +package leafnodes + +import ( + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/types" + "reflect" +) + +type MeasureNode struct { + runner *runner + + text string + flag types.FlagType + samples int + benchmarker *benchmarker +} + +func NewMeasureNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, samples int, failer *failer.Failer, componentIndex int) *MeasureNode { + benchmarker := newBenchmarker() + + wrappedBody := func() { + reflect.ValueOf(body).Call([]reflect.Value{reflect.ValueOf(benchmarker)}) + } + + return &MeasureNode{ + runner: newRunner(wrappedBody, codeLocation, 0, failer, types.SpecComponentTypeMeasure, componentIndex), + + text: text, + flag: flag, + samples: samples, + benchmarker: benchmarker, + } +} + +func (node *MeasureNode) Run() (outcome types.SpecState, failure types.SpecFailure) { + return node.runner.run() +} + +func (node *MeasureNode) MeasurementsReport() map[string]*types.SpecMeasurement { + return node.benchmarker.measurementsReport() +} + +func (node *MeasureNode) Type() types.SpecComponentType { + return types.SpecComponentTypeMeasure +} + +func (node *MeasureNode) Text() string { + return node.text +} + +func (node *MeasureNode) Flag() types.FlagType { + return node.flag +} + +func (node *MeasureNode) CodeLocation() types.CodeLocation { + return node.runner.codeLocation +} + +func (node *MeasureNode) Samples() int { + return node.samples +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go new file mode 100644 index 0000000000..870ad826da --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go @@ -0,0 +1,113 @@ +package leafnodes + +import ( + "fmt" + "github.com/onsi/ginkgo/internal/codelocation" + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/types" + "reflect" + "time" +) + +type runner struct { + isAsync bool + asyncFunc func(chan<- interface{}) + syncFunc func() + codeLocation types.CodeLocation + timeoutThreshold time.Duration + nodeType types.SpecComponentType + componentIndex int + failer *failer.Failer +} + +func newRunner(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, nodeType types.SpecComponentType, componentIndex int) *runner { + bodyType := reflect.TypeOf(body) + if bodyType.Kind() != reflect.Func { + panic(fmt.Sprintf("Expected a function but got something else at %v", codeLocation)) + } + + runner := &runner{ + codeLocation: codeLocation, + timeoutThreshold: timeout, + failer: failer, + nodeType: nodeType, + componentIndex: componentIndex, + } + + switch bodyType.NumIn() { + case 0: + runner.syncFunc = body.(func()) + return runner + case 1: + if !(bodyType.In(0).Kind() == reflect.Chan && bodyType.In(0).Elem().Kind() == reflect.Interface) { + panic(fmt.Sprintf("Must pass a Done channel to function at %v", codeLocation)) + } + + wrappedBody := func(done chan<- interface{}) { + bodyValue := reflect.ValueOf(body) + bodyValue.Call([]reflect.Value{reflect.ValueOf(done)}) + } + + runner.isAsync = true + runner.asyncFunc = wrappedBody + return runner + } + + panic(fmt.Sprintf("Too many arguments to function at %v", codeLocation)) +} + +func (r *runner) run() (outcome types.SpecState, failure types.SpecFailure) { + if r.isAsync { + return r.runAsync() + } else { + return r.runSync() + } +} + +func (r *runner) runAsync() (outcome types.SpecState, failure types.SpecFailure) { + done := make(chan interface{}, 1) + + go func() { + finished := false + + defer func() { + if e := recover(); e != nil || !finished { + r.failer.Panic(codelocation.New(2), e) + select { + case <-done: + break + default: + close(done) + } + } + }() + + r.asyncFunc(done) + finished = true + }() + + select { + case <-done: + case <-time.After(r.timeoutThreshold): + r.failer.Timeout(r.codeLocation) + } + + failure, outcome = r.failer.Drain(r.nodeType, r.componentIndex, r.codeLocation) + return +} +func (r *runner) runSync() (outcome types.SpecState, failure types.SpecFailure) { + finished := false + + defer func() { + if e := recover(); e != nil || !finished { + r.failer.Panic(codelocation.New(2), e) + } + + failure, outcome = r.failer.Drain(r.nodeType, r.componentIndex, r.codeLocation) + }() + + r.syncFunc() + finished = true + + return +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go new file mode 100644 index 0000000000..6b725a6315 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go @@ -0,0 +1,41 @@ +package leafnodes + +import ( + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/types" + "time" +) + +type SetupNode struct { + runner *runner +} + +func (node *SetupNode) Run() (outcome types.SpecState, failure types.SpecFailure) { + return node.runner.run() +} + +func (node *SetupNode) Type() types.SpecComponentType { + return node.runner.nodeType +} + +func (node *SetupNode) CodeLocation() types.CodeLocation { + return node.runner.codeLocation +} + +func NewBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { + return &SetupNode{ + runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeBeforeEach, componentIndex), + } +} + +func NewAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { + return &SetupNode{ + runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeAfterEach, componentIndex), + } +} + +func NewJustBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { + return &SetupNode{ + runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeJustBeforeEach, componentIndex), + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go new file mode 100644 index 0000000000..2ccc7dc0fb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go @@ -0,0 +1,54 @@ +package leafnodes + +import ( + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/types" + "time" +) + +type SuiteNode interface { + Run(parallelNode int, parallelTotal int, syncHost string) bool + Passed() bool + Summary() *types.SetupSummary +} + +type simpleSuiteNode struct { + runner *runner + outcome types.SpecState + failure types.SpecFailure + runTime time.Duration +} + +func (node *simpleSuiteNode) Run(parallelNode int, parallelTotal int, syncHost string) bool { + t := time.Now() + node.outcome, node.failure = node.runner.run() + node.runTime = time.Since(t) + + return node.outcome == types.SpecStatePassed +} + +func (node *simpleSuiteNode) Passed() bool { + return node.outcome == types.SpecStatePassed +} + +func (node *simpleSuiteNode) Summary() *types.SetupSummary { + return &types.SetupSummary{ + ComponentType: node.runner.nodeType, + CodeLocation: node.runner.codeLocation, + State: node.outcome, + RunTime: node.runTime, + Failure: node.failure, + } +} + +func NewBeforeSuiteNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer) SuiteNode { + return &simpleSuiteNode{ + runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeBeforeSuite, 0), + } +} + +func NewAfterSuiteNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer) SuiteNode { + return &simpleSuiteNode{ + runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeAfterSuite, 0), + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/synchronized_after_suite_node.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/synchronized_after_suite_node.go new file mode 100644 index 0000000000..e7030d9149 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/synchronized_after_suite_node.go @@ -0,0 +1,89 @@ +package leafnodes + +import ( + "encoding/json" + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/types" + "io/ioutil" + "net/http" + "time" +) + +type synchronizedAfterSuiteNode struct { + runnerA *runner + runnerB *runner + + outcome types.SpecState + failure types.SpecFailure + runTime time.Duration +} + +func NewSynchronizedAfterSuiteNode(bodyA interface{}, bodyB interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer) SuiteNode { + return &synchronizedAfterSuiteNode{ + runnerA: newRunner(bodyA, codeLocation, timeout, failer, types.SpecComponentTypeAfterSuite, 0), + runnerB: newRunner(bodyB, codeLocation, timeout, failer, types.SpecComponentTypeAfterSuite, 0), + } +} + +func (node *synchronizedAfterSuiteNode) Run(parallelNode int, parallelTotal int, syncHost string) bool { + node.outcome, node.failure = node.runnerA.run() + + if parallelNode == 1 { + if parallelTotal > 1 { + node.waitUntilOtherNodesAreDone(syncHost) + } + + outcome, failure := node.runnerB.run() + + if node.outcome == types.SpecStatePassed { + node.outcome, node.failure = outcome, failure + } + } + + return node.outcome == types.SpecStatePassed +} + +func (node *synchronizedAfterSuiteNode) Passed() bool { + return node.outcome == types.SpecStatePassed +} + +func (node *synchronizedAfterSuiteNode) Summary() *types.SetupSummary { + return &types.SetupSummary{ + ComponentType: node.runnerA.nodeType, + CodeLocation: node.runnerA.codeLocation, + State: node.outcome, + RunTime: node.runTime, + Failure: node.failure, + } +} + +func (node *synchronizedAfterSuiteNode) waitUntilOtherNodesAreDone(syncHost string) { + for { + if node.canRun(syncHost) { + return + } + + time.Sleep(50 * time.Millisecond) + } +} + +func (node *synchronizedAfterSuiteNode) canRun(syncHost string) bool { + resp, err := http.Get(syncHost + "/RemoteAfterSuiteData") + if err != nil || resp.StatusCode != http.StatusOK { + return false + } + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return false + } + resp.Body.Close() + + afterSuiteData := types.RemoteAfterSuiteData{} + err = json.Unmarshal(body, &afterSuiteData) + if err != nil { + return false + } + + return afterSuiteData.CanRun +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/synchronized_before_suite_node.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/synchronized_before_suite_node.go new file mode 100644 index 0000000000..76a9679813 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/leafnodes/synchronized_before_suite_node.go @@ -0,0 +1,182 @@ +package leafnodes + +import ( + "bytes" + "encoding/json" + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/types" + "io/ioutil" + "net/http" + "reflect" + "time" +) + +type synchronizedBeforeSuiteNode struct { + runnerA *runner + runnerB *runner + + data []byte + + outcome types.SpecState + failure types.SpecFailure + runTime time.Duration +} + +func NewSynchronizedBeforeSuiteNode(bodyA interface{}, bodyB interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer) SuiteNode { + node := &synchronizedBeforeSuiteNode{} + + node.runnerA = newRunner(node.wrapA(bodyA), codeLocation, timeout, failer, types.SpecComponentTypeBeforeSuite, 0) + node.runnerB = newRunner(node.wrapB(bodyB), codeLocation, timeout, failer, types.SpecComponentTypeBeforeSuite, 0) + + return node +} + +func (node *synchronizedBeforeSuiteNode) Run(parallelNode int, parallelTotal int, syncHost string) bool { + t := time.Now() + defer func() { + node.runTime = time.Since(t) + }() + + if parallelNode == 1 { + node.outcome, node.failure = node.runA(parallelTotal, syncHost) + } else { + node.outcome, node.failure = node.waitForA(syncHost) + } + + if node.outcome != types.SpecStatePassed { + return false + } + node.outcome, node.failure = node.runnerB.run() + + return node.outcome == types.SpecStatePassed +} + +func (node *synchronizedBeforeSuiteNode) runA(parallelTotal int, syncHost string) (types.SpecState, types.SpecFailure) { + outcome, failure := node.runnerA.run() + + if parallelTotal > 1 { + state := types.RemoteBeforeSuiteStatePassed + if outcome != types.SpecStatePassed { + state = types.RemoteBeforeSuiteStateFailed + } + json := (types.RemoteBeforeSuiteData{ + Data: node.data, + State: state, + }).ToJSON() + http.Post(syncHost+"/BeforeSuiteState", "application/json", bytes.NewBuffer(json)) + } + + return outcome, failure +} + +func (node *synchronizedBeforeSuiteNode) waitForA(syncHost string) (types.SpecState, types.SpecFailure) { + failure := func(message string) types.SpecFailure { + return types.SpecFailure{ + Message: message, + Location: node.runnerA.codeLocation, + ComponentType: node.runnerA.nodeType, + ComponentIndex: node.runnerA.componentIndex, + ComponentCodeLocation: node.runnerA.codeLocation, + } + } + for { + resp, err := http.Get(syncHost + "/BeforeSuiteState") + if err != nil || resp.StatusCode != http.StatusOK { + return types.SpecStateFailed, failure("Failed to fetch BeforeSuite state") + } + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return types.SpecStateFailed, failure("Failed to read BeforeSuite state") + } + resp.Body.Close() + + beforeSuiteData := types.RemoteBeforeSuiteData{} + err = json.Unmarshal(body, &beforeSuiteData) + if err != nil { + return types.SpecStateFailed, failure("Failed to decode BeforeSuite state") + } + + switch beforeSuiteData.State { + case types.RemoteBeforeSuiteStatePassed: + node.data = beforeSuiteData.Data + return types.SpecStatePassed, types.SpecFailure{} + case types.RemoteBeforeSuiteStateFailed: + return types.SpecStateFailed, failure("BeforeSuite on Node 1 failed") + case types.RemoteBeforeSuiteStateDisappeared: + return types.SpecStateFailed, failure("Node 1 disappeared before completing BeforeSuite") + } + + time.Sleep(50 * time.Millisecond) + } + + return types.SpecStateFailed, failure("Shouldn't get here!") +} + +func (node *synchronizedBeforeSuiteNode) Passed() bool { + return node.outcome == types.SpecStatePassed +} + +func (node *synchronizedBeforeSuiteNode) Summary() *types.SetupSummary { + return &types.SetupSummary{ + ComponentType: node.runnerA.nodeType, + CodeLocation: node.runnerA.codeLocation, + State: node.outcome, + RunTime: node.runTime, + Failure: node.failure, + } +} + +func (node *synchronizedBeforeSuiteNode) wrapA(bodyA interface{}) interface{} { + typeA := reflect.TypeOf(bodyA) + if typeA.Kind() != reflect.Func { + panic("SynchronizedBeforeSuite expects a function as its first argument") + } + + takesNothing := typeA.NumIn() == 0 + takesADoneChannel := typeA.NumIn() == 1 && typeA.In(0).Kind() == reflect.Chan && typeA.In(0).Elem().Kind() == reflect.Interface + returnsBytes := typeA.NumOut() == 1 && typeA.Out(0).Kind() == reflect.Slice && typeA.Out(0).Elem().Kind() == reflect.Uint8 + + if !((takesNothing || takesADoneChannel) && returnsBytes) { + panic("SynchronizedBeforeSuite's first argument should be a function that returns []byte and either takes no arguments or takes a Done channel.") + } + + if takesADoneChannel { + return func(done chan<- interface{}) { + out := reflect.ValueOf(bodyA).Call([]reflect.Value{reflect.ValueOf(done)}) + node.data = out[0].Interface().([]byte) + } + } + + return func() { + out := reflect.ValueOf(bodyA).Call([]reflect.Value{}) + node.data = out[0].Interface().([]byte) + } +} + +func (node *synchronizedBeforeSuiteNode) wrapB(bodyB interface{}) interface{} { + typeB := reflect.TypeOf(bodyB) + if typeB.Kind() != reflect.Func { + panic("SynchronizedBeforeSuite expects a function as its second argument") + } + + returnsNothing := typeB.NumOut() == 0 + takesBytesOnly := typeB.NumIn() == 1 && typeB.In(0).Kind() == reflect.Slice && typeB.In(0).Elem().Kind() == reflect.Uint8 + takesBytesAndDone := typeB.NumIn() == 2 && + typeB.In(0).Kind() == reflect.Slice && typeB.In(0).Elem().Kind() == reflect.Uint8 && + typeB.In(1).Kind() == reflect.Chan && typeB.In(1).Elem().Kind() == reflect.Interface + + if !((takesBytesOnly || takesBytesAndDone) && returnsNothing) { + panic("SynchronizedBeforeSuite's second argument should be a function that returns nothing and either takes []byte or ([]byte, Done)") + } + + if takesBytesAndDone { + return func(done chan<- interface{}) { + reflect.ValueOf(bodyB).Call([]reflect.Value{reflect.ValueOf(node.data), reflect.ValueOf(done)}) + } + } + + return func() { + reflect.ValueOf(bodyB).Call([]reflect.Value{reflect.ValueOf(node.data)}) + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go new file mode 100644 index 0000000000..522d44e357 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go @@ -0,0 +1,249 @@ +/* + +Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output +coherently as tests complete. You shouldn't need to use this in your code. To run tests in parallel: + + ginkgo -nodes=N + +where N is the number of nodes you desire. +*/ +package remote + +import ( + "time" + + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/reporters/stenographer" + "github.com/onsi/ginkgo/types" +) + +type configAndSuite struct { + config config.GinkgoConfigType + summary *types.SuiteSummary +} + +type Aggregator struct { + nodeCount int + config config.DefaultReporterConfigType + stenographer stenographer.Stenographer + result chan bool + + suiteBeginnings chan configAndSuite + aggregatedSuiteBeginnings []configAndSuite + + beforeSuites chan *types.SetupSummary + aggregatedBeforeSuites []*types.SetupSummary + + afterSuites chan *types.SetupSummary + aggregatedAfterSuites []*types.SetupSummary + + specCompletions chan *types.SpecSummary + completedSpecs []*types.SpecSummary + + suiteEndings chan *types.SuiteSummary + aggregatedSuiteEndings []*types.SuiteSummary + specs []*types.SpecSummary + + startTime time.Time +} + +func NewAggregator(nodeCount int, result chan bool, config config.DefaultReporterConfigType, stenographer stenographer.Stenographer) *Aggregator { + aggregator := &Aggregator{ + nodeCount: nodeCount, + result: result, + config: config, + stenographer: stenographer, + + suiteBeginnings: make(chan configAndSuite, 0), + beforeSuites: make(chan *types.SetupSummary, 0), + afterSuites: make(chan *types.SetupSummary, 0), + specCompletions: make(chan *types.SpecSummary, 0), + suiteEndings: make(chan *types.SuiteSummary, 0), + } + + go aggregator.mux() + + return aggregator +} + +func (aggregator *Aggregator) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) { + aggregator.suiteBeginnings <- configAndSuite{config, summary} +} + +func (aggregator *Aggregator) BeforeSuiteDidRun(setupSummary *types.SetupSummary) { + aggregator.beforeSuites <- setupSummary +} + +func (aggregator *Aggregator) AfterSuiteDidRun(setupSummary *types.SetupSummary) { + aggregator.afterSuites <- setupSummary +} + +func (aggregator *Aggregator) SpecWillRun(specSummary *types.SpecSummary) { + //noop +} + +func (aggregator *Aggregator) SpecDidComplete(specSummary *types.SpecSummary) { + aggregator.specCompletions <- specSummary +} + +func (aggregator *Aggregator) SpecSuiteDidEnd(summary *types.SuiteSummary) { + aggregator.suiteEndings <- summary +} + +func (aggregator *Aggregator) mux() { +loop: + for { + select { + case configAndSuite := <-aggregator.suiteBeginnings: + aggregator.registerSuiteBeginning(configAndSuite) + case setupSummary := <-aggregator.beforeSuites: + aggregator.registerBeforeSuite(setupSummary) + case setupSummary := <-aggregator.afterSuites: + aggregator.registerAfterSuite(setupSummary) + case specSummary := <-aggregator.specCompletions: + aggregator.registerSpecCompletion(specSummary) + case suite := <-aggregator.suiteEndings: + finished, passed := aggregator.registerSuiteEnding(suite) + if finished { + aggregator.result <- passed + break loop + } + } + } +} + +func (aggregator *Aggregator) registerSuiteBeginning(configAndSuite configAndSuite) { + aggregator.aggregatedSuiteBeginnings = append(aggregator.aggregatedSuiteBeginnings, configAndSuite) + + if len(aggregator.aggregatedSuiteBeginnings) == 1 { + aggregator.startTime = time.Now() + } + + if len(aggregator.aggregatedSuiteBeginnings) != aggregator.nodeCount { + return + } + + aggregator.stenographer.AnnounceSuite(configAndSuite.summary.SuiteDescription, configAndSuite.config.RandomSeed, configAndSuite.config.RandomizeAllSpecs, aggregator.config.Succinct) + + totalNumberOfSpecs := 0 + if len(aggregator.aggregatedSuiteBeginnings) > 0 { + totalNumberOfSpecs = configAndSuite.summary.NumberOfSpecsBeforeParallelization + } + + aggregator.stenographer.AnnounceTotalNumberOfSpecs(totalNumberOfSpecs, aggregator.config.Succinct) + aggregator.stenographer.AnnounceAggregatedParallelRun(aggregator.nodeCount, aggregator.config.Succinct) + aggregator.flushCompletedSpecs() +} + +func (aggregator *Aggregator) registerBeforeSuite(setupSummary *types.SetupSummary) { + aggregator.aggregatedBeforeSuites = append(aggregator.aggregatedBeforeSuites, setupSummary) + aggregator.flushCompletedSpecs() +} + +func (aggregator *Aggregator) registerAfterSuite(setupSummary *types.SetupSummary) { + aggregator.aggregatedAfterSuites = append(aggregator.aggregatedAfterSuites, setupSummary) + aggregator.flushCompletedSpecs() +} + +func (aggregator *Aggregator) registerSpecCompletion(specSummary *types.SpecSummary) { + aggregator.completedSpecs = append(aggregator.completedSpecs, specSummary) + aggregator.specs = append(aggregator.specs, specSummary) + aggregator.flushCompletedSpecs() +} + +func (aggregator *Aggregator) flushCompletedSpecs() { + if len(aggregator.aggregatedSuiteBeginnings) != aggregator.nodeCount { + return + } + + for _, setupSummary := range aggregator.aggregatedBeforeSuites { + aggregator.announceBeforeSuite(setupSummary) + } + + for _, specSummary := range aggregator.completedSpecs { + aggregator.announceSpec(specSummary) + } + + for _, setupSummary := range aggregator.aggregatedAfterSuites { + aggregator.announceAfterSuite(setupSummary) + } + + aggregator.aggregatedBeforeSuites = []*types.SetupSummary{} + aggregator.completedSpecs = []*types.SpecSummary{} + aggregator.aggregatedAfterSuites = []*types.SetupSummary{} +} + +func (aggregator *Aggregator) announceBeforeSuite(setupSummary *types.SetupSummary) { + aggregator.stenographer.AnnounceCapturedOutput(setupSummary.CapturedOutput) + if setupSummary.State != types.SpecStatePassed { + aggregator.stenographer.AnnounceBeforeSuiteFailure(setupSummary, aggregator.config.Succinct, aggregator.config.FullTrace) + } +} + +func (aggregator *Aggregator) announceAfterSuite(setupSummary *types.SetupSummary) { + aggregator.stenographer.AnnounceCapturedOutput(setupSummary.CapturedOutput) + if setupSummary.State != types.SpecStatePassed { + aggregator.stenographer.AnnounceAfterSuiteFailure(setupSummary, aggregator.config.Succinct, aggregator.config.FullTrace) + } +} + +func (aggregator *Aggregator) announceSpec(specSummary *types.SpecSummary) { + if aggregator.config.Verbose && specSummary.State != types.SpecStatePending && specSummary.State != types.SpecStateSkipped { + aggregator.stenographer.AnnounceSpecWillRun(specSummary) + } + + aggregator.stenographer.AnnounceCapturedOutput(specSummary.CapturedOutput) + + switch specSummary.State { + case types.SpecStatePassed: + if specSummary.IsMeasurement { + aggregator.stenographer.AnnounceSuccesfulMeasurement(specSummary, aggregator.config.Succinct) + } else if specSummary.RunTime.Seconds() >= aggregator.config.SlowSpecThreshold { + aggregator.stenographer.AnnounceSuccesfulSlowSpec(specSummary, aggregator.config.Succinct) + } else { + aggregator.stenographer.AnnounceSuccesfulSpec(specSummary) + } + + case types.SpecStatePending: + aggregator.stenographer.AnnouncePendingSpec(specSummary, aggregator.config.NoisyPendings && !aggregator.config.Succinct) + case types.SpecStateSkipped: + aggregator.stenographer.AnnounceSkippedSpec(specSummary, aggregator.config.Succinct, aggregator.config.FullTrace) + case types.SpecStateTimedOut: + aggregator.stenographer.AnnounceSpecTimedOut(specSummary, aggregator.config.Succinct, aggregator.config.FullTrace) + case types.SpecStatePanicked: + aggregator.stenographer.AnnounceSpecPanicked(specSummary, aggregator.config.Succinct, aggregator.config.FullTrace) + case types.SpecStateFailed: + aggregator.stenographer.AnnounceSpecFailed(specSummary, aggregator.config.Succinct, aggregator.config.FullTrace) + } +} + +func (aggregator *Aggregator) registerSuiteEnding(suite *types.SuiteSummary) (finished bool, passed bool) { + aggregator.aggregatedSuiteEndings = append(aggregator.aggregatedSuiteEndings, suite) + if len(aggregator.aggregatedSuiteEndings) < aggregator.nodeCount { + return false, false + } + + aggregatedSuiteSummary := &types.SuiteSummary{} + aggregatedSuiteSummary.SuiteSucceeded = true + + for _, suiteSummary := range aggregator.aggregatedSuiteEndings { + if suiteSummary.SuiteSucceeded == false { + aggregatedSuiteSummary.SuiteSucceeded = false + } + + aggregatedSuiteSummary.NumberOfSpecsThatWillBeRun += suiteSummary.NumberOfSpecsThatWillBeRun + aggregatedSuiteSummary.NumberOfTotalSpecs += suiteSummary.NumberOfTotalSpecs + aggregatedSuiteSummary.NumberOfPassedSpecs += suiteSummary.NumberOfPassedSpecs + aggregatedSuiteSummary.NumberOfFailedSpecs += suiteSummary.NumberOfFailedSpecs + aggregatedSuiteSummary.NumberOfPendingSpecs += suiteSummary.NumberOfPendingSpecs + aggregatedSuiteSummary.NumberOfSkippedSpecs += suiteSummary.NumberOfSkippedSpecs + aggregatedSuiteSummary.NumberOfFlakedSpecs += suiteSummary.NumberOfFlakedSpecs + } + + aggregatedSuiteSummary.RunTime = time.Since(aggregator.startTime) + + aggregator.stenographer.SummarizeFailures(aggregator.specs) + aggregator.stenographer.AnnounceSpecRunCompletion(aggregatedSuiteSummary, aggregator.config.Succinct) + + return true, aggregatedSuiteSummary.SuiteSucceeded +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go new file mode 100644 index 0000000000..025eb50644 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go @@ -0,0 +1,90 @@ +package remote + +import ( + "bytes" + "encoding/json" + "io" + "net/http" + + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/types" +) + +//An interface to net/http's client to allow the injection of fakes under test +type Poster interface { + Post(url string, bodyType string, body io.Reader) (resp *http.Response, err error) +} + +/* +The ForwardingReporter is a Ginkgo reporter that forwards information to +a Ginkgo remote server. + +When streaming parallel test output, this repoter is automatically installed by Ginkgo. + +This is accomplished by passing in the GINKGO_REMOTE_REPORTING_SERVER environment variable to `go test`, the Ginkgo test runner +detects this environment variable (which should contain the host of the server) and automatically installs a ForwardingReporter +in place of Ginkgo's DefaultReporter. +*/ + +type ForwardingReporter struct { + serverHost string + poster Poster + outputInterceptor OutputInterceptor +} + +func NewForwardingReporter(serverHost string, poster Poster, outputInterceptor OutputInterceptor) *ForwardingReporter { + return &ForwardingReporter{ + serverHost: serverHost, + poster: poster, + outputInterceptor: outputInterceptor, + } +} + +func (reporter *ForwardingReporter) post(path string, data interface{}) { + encoded, _ := json.Marshal(data) + buffer := bytes.NewBuffer(encoded) + reporter.poster.Post(reporter.serverHost+path, "application/json", buffer) +} + +func (reporter *ForwardingReporter) SpecSuiteWillBegin(conf config.GinkgoConfigType, summary *types.SuiteSummary) { + data := struct { + Config config.GinkgoConfigType `json:"config"` + Summary *types.SuiteSummary `json:"suite-summary"` + }{ + conf, + summary, + } + + reporter.outputInterceptor.StartInterceptingOutput() + reporter.post("/SpecSuiteWillBegin", data) +} + +func (reporter *ForwardingReporter) BeforeSuiteDidRun(setupSummary *types.SetupSummary) { + output, _ := reporter.outputInterceptor.StopInterceptingAndReturnOutput() + reporter.outputInterceptor.StartInterceptingOutput() + setupSummary.CapturedOutput = output + reporter.post("/BeforeSuiteDidRun", setupSummary) +} + +func (reporter *ForwardingReporter) SpecWillRun(specSummary *types.SpecSummary) { + reporter.post("/SpecWillRun", specSummary) +} + +func (reporter *ForwardingReporter) SpecDidComplete(specSummary *types.SpecSummary) { + output, _ := reporter.outputInterceptor.StopInterceptingAndReturnOutput() + reporter.outputInterceptor.StartInterceptingOutput() + specSummary.CapturedOutput = output + reporter.post("/SpecDidComplete", specSummary) +} + +func (reporter *ForwardingReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary) { + output, _ := reporter.outputInterceptor.StopInterceptingAndReturnOutput() + reporter.outputInterceptor.StartInterceptingOutput() + setupSummary.CapturedOutput = output + reporter.post("/AfterSuiteDidRun", setupSummary) +} + +func (reporter *ForwardingReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) { + reporter.outputInterceptor.StopInterceptingAndReturnOutput() + reporter.post("/SpecSuiteDidEnd", summary) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor.go new file mode 100644 index 0000000000..093f4513c0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor.go @@ -0,0 +1,10 @@ +package remote + +/* +The OutputInterceptor is used by the ForwardingReporter to +intercept and capture all stdin and stderr output during a test run. +*/ +type OutputInterceptor interface { + StartInterceptingOutput() error + StopInterceptingAndReturnOutput() (string, error) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go new file mode 100644 index 0000000000..980065da57 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go @@ -0,0 +1,55 @@ +// +build freebsd openbsd netbsd dragonfly darwin linux solaris + +package remote + +import ( + "errors" + "io/ioutil" + "os" +) + +func NewOutputInterceptor() OutputInterceptor { + return &outputInterceptor{} +} + +type outputInterceptor struct { + redirectFile *os.File + intercepting bool +} + +func (interceptor *outputInterceptor) StartInterceptingOutput() error { + if interceptor.intercepting { + return errors.New("Already intercepting output!") + } + interceptor.intercepting = true + + var err error + + interceptor.redirectFile, err = ioutil.TempFile("", "ginkgo-output") + if err != nil { + return err + } + + // Call a function in ./syscall_dup_*.go + // If building for everything other than linux_arm64, + // use a "normal" syscall.Dup2(oldfd, newfd) call. If building for linux_arm64 (which doesn't have syscall.Dup2) + // call syscall.Dup3(oldfd, newfd, 0). They are nearly identical, see: http://linux.die.net/man/2/dup3 + syscallDup(int(interceptor.redirectFile.Fd()), 1) + syscallDup(int(interceptor.redirectFile.Fd()), 2) + + return nil +} + +func (interceptor *outputInterceptor) StopInterceptingAndReturnOutput() (string, error) { + if !interceptor.intercepting { + return "", errors.New("Not intercepting output!") + } + + interceptor.redirectFile.Close() + output, err := ioutil.ReadFile(interceptor.redirectFile.Name()) + os.Remove(interceptor.redirectFile.Name()) + + interceptor.intercepting = false + + return string(output), err +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go new file mode 100644 index 0000000000..c8f97d97f0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go @@ -0,0 +1,33 @@ +// +build windows + +package remote + +import ( + "errors" +) + +func NewOutputInterceptor() OutputInterceptor { + return &outputInterceptor{} +} + +type outputInterceptor struct { + intercepting bool +} + +func (interceptor *outputInterceptor) StartInterceptingOutput() error { + if interceptor.intercepting { + return errors.New("Already intercepting output!") + } + interceptor.intercepting = true + + // not working on windows... + + return nil +} + +func (interceptor *outputInterceptor) StopInterceptingAndReturnOutput() (string, error) { + // not working on windows... + interceptor.intercepting = false + + return "", nil +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/server.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/server.go new file mode 100644 index 0000000000..297af2ebff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/server.go @@ -0,0 +1,224 @@ +/* + +The remote package provides the pieces to allow Ginkgo test suites to report to remote listeners. +This is used, primarily, to enable streaming parallel test output but has, in principal, broader applications (e.g. streaming test output to a browser). + +*/ + +package remote + +import ( + "encoding/json" + "io/ioutil" + "net" + "net/http" + "sync" + + "github.com/onsi/ginkgo/internal/spec_iterator" + + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/reporters" + "github.com/onsi/ginkgo/types" +) + +/* +Server spins up on an automatically selected port and listens for communication from the forwarding reporter. +It then forwards that communication to attached reporters. +*/ +type Server struct { + listener net.Listener + reporters []reporters.Reporter + alives []func() bool + lock *sync.Mutex + beforeSuiteData types.RemoteBeforeSuiteData + parallelTotal int + counter int +} + +//Create a new server, automatically selecting a port +func NewServer(parallelTotal int) (*Server, error) { + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + return nil, err + } + return &Server{ + listener: listener, + lock: &sync.Mutex{}, + alives: make([]func() bool, parallelTotal), + beforeSuiteData: types.RemoteBeforeSuiteData{nil, types.RemoteBeforeSuiteStatePending}, + parallelTotal: parallelTotal, + }, nil +} + +//Start the server. You don't need to `go s.Start()`, just `s.Start()` +func (server *Server) Start() { + httpServer := &http.Server{} + mux := http.NewServeMux() + httpServer.Handler = mux + + //streaming endpoints + mux.HandleFunc("/SpecSuiteWillBegin", server.specSuiteWillBegin) + mux.HandleFunc("/BeforeSuiteDidRun", server.beforeSuiteDidRun) + mux.HandleFunc("/AfterSuiteDidRun", server.afterSuiteDidRun) + mux.HandleFunc("/SpecWillRun", server.specWillRun) + mux.HandleFunc("/SpecDidComplete", server.specDidComplete) + mux.HandleFunc("/SpecSuiteDidEnd", server.specSuiteDidEnd) + + //synchronization endpoints + mux.HandleFunc("/BeforeSuiteState", server.handleBeforeSuiteState) + mux.HandleFunc("/RemoteAfterSuiteData", server.handleRemoteAfterSuiteData) + mux.HandleFunc("/counter", server.handleCounter) + mux.HandleFunc("/has-counter", server.handleHasCounter) //for backward compatibility + + go httpServer.Serve(server.listener) +} + +//Stop the server +func (server *Server) Close() { + server.listener.Close() +} + +//The address the server can be reached it. Pass this into the `ForwardingReporter`. +func (server *Server) Address() string { + return "http://" + server.listener.Addr().String() +} + +// +// Streaming Endpoints +// + +//The server will forward all received messages to Ginkgo reporters registered with `RegisterReporters` +func (server *Server) readAll(request *http.Request) []byte { + defer request.Body.Close() + body, _ := ioutil.ReadAll(request.Body) + return body +} + +func (server *Server) RegisterReporters(reporters ...reporters.Reporter) { + server.reporters = reporters +} + +func (server *Server) specSuiteWillBegin(writer http.ResponseWriter, request *http.Request) { + body := server.readAll(request) + + var data struct { + Config config.GinkgoConfigType `json:"config"` + Summary *types.SuiteSummary `json:"suite-summary"` + } + + json.Unmarshal(body, &data) + + for _, reporter := range server.reporters { + reporter.SpecSuiteWillBegin(data.Config, data.Summary) + } +} + +func (server *Server) beforeSuiteDidRun(writer http.ResponseWriter, request *http.Request) { + body := server.readAll(request) + var setupSummary *types.SetupSummary + json.Unmarshal(body, &setupSummary) + + for _, reporter := range server.reporters { + reporter.BeforeSuiteDidRun(setupSummary) + } +} + +func (server *Server) afterSuiteDidRun(writer http.ResponseWriter, request *http.Request) { + body := server.readAll(request) + var setupSummary *types.SetupSummary + json.Unmarshal(body, &setupSummary) + + for _, reporter := range server.reporters { + reporter.AfterSuiteDidRun(setupSummary) + } +} + +func (server *Server) specWillRun(writer http.ResponseWriter, request *http.Request) { + body := server.readAll(request) + var specSummary *types.SpecSummary + json.Unmarshal(body, &specSummary) + + for _, reporter := range server.reporters { + reporter.SpecWillRun(specSummary) + } +} + +func (server *Server) specDidComplete(writer http.ResponseWriter, request *http.Request) { + body := server.readAll(request) + var specSummary *types.SpecSummary + json.Unmarshal(body, &specSummary) + + for _, reporter := range server.reporters { + reporter.SpecDidComplete(specSummary) + } +} + +func (server *Server) specSuiteDidEnd(writer http.ResponseWriter, request *http.Request) { + body := server.readAll(request) + var suiteSummary *types.SuiteSummary + json.Unmarshal(body, &suiteSummary) + + for _, reporter := range server.reporters { + reporter.SpecSuiteDidEnd(suiteSummary) + } +} + +// +// Synchronization Endpoints +// + +func (server *Server) RegisterAlive(node int, alive func() bool) { + server.lock.Lock() + defer server.lock.Unlock() + server.alives[node-1] = alive +} + +func (server *Server) nodeIsAlive(node int) bool { + server.lock.Lock() + defer server.lock.Unlock() + alive := server.alives[node-1] + if alive == nil { + return true + } + return alive() +} + +func (server *Server) handleBeforeSuiteState(writer http.ResponseWriter, request *http.Request) { + if request.Method == "POST" { + dec := json.NewDecoder(request.Body) + dec.Decode(&(server.beforeSuiteData)) + } else { + beforeSuiteData := server.beforeSuiteData + if beforeSuiteData.State == types.RemoteBeforeSuiteStatePending && !server.nodeIsAlive(1) { + beforeSuiteData.State = types.RemoteBeforeSuiteStateDisappeared + } + enc := json.NewEncoder(writer) + enc.Encode(beforeSuiteData) + } +} + +func (server *Server) handleRemoteAfterSuiteData(writer http.ResponseWriter, request *http.Request) { + afterSuiteData := types.RemoteAfterSuiteData{ + CanRun: true, + } + for i := 2; i <= server.parallelTotal; i++ { + afterSuiteData.CanRun = afterSuiteData.CanRun && !server.nodeIsAlive(i) + } + + enc := json.NewEncoder(writer) + enc.Encode(afterSuiteData) +} + +func (server *Server) handleCounter(writer http.ResponseWriter, request *http.Request) { + c := spec_iterator.Counter{} + server.lock.Lock() + c.Index = server.counter + server.counter = server.counter + 1 + server.lock.Unlock() + + json.NewEncoder(writer).Encode(c) +} + +func (server *Server) handleHasCounter(writer http.ResponseWriter, request *http.Request) { + writer.Write([]byte("")) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_linux_arm64.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_linux_arm64.go new file mode 100644 index 0000000000..5c59728ea9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_linux_arm64.go @@ -0,0 +1,11 @@ +// +build linux,arm64 + +package remote + +import "syscall" + +// linux_arm64 doesn't have syscall.Dup2 which ginkgo uses, so +// use the nearly identical syscall.Dup3 instead +func syscallDup(oldfd int, newfd int) (err error) { + return syscall.Dup3(oldfd, newfd, 0) +} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_solaris.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_solaris.go new file mode 100644 index 0000000000..ecf9cafb66 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_solaris.go @@ -0,0 +1,9 @@ +// +build solaris + +package remote + +import "golang.org/x/sys/unix" + +func syscallDup(oldfd int, newfd int) (err error) { + return unix.Dup2(oldfd, newfd) +} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_unix.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_unix.go new file mode 100644 index 0000000000..cacdd0e649 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_unix.go @@ -0,0 +1,11 @@ +// +build !linux !arm64 +// +build !windows +// +build !solaris + +package remote + +import "syscall" + +func syscallDup(oldfd int, newfd int) (err error) { + return syscall.Dup2(oldfd, newfd) +} \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec/spec.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec/spec.go new file mode 100644 index 0000000000..d32dec6997 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec/spec.go @@ -0,0 +1,206 @@ +package spec + +import ( + "fmt" + "io" + "time" + + "github.com/onsi/ginkgo/internal/containernode" + "github.com/onsi/ginkgo/internal/leafnodes" + "github.com/onsi/ginkgo/types" +) + +type Spec struct { + subject leafnodes.SubjectNode + focused bool + announceProgress bool + + containers []*containernode.ContainerNode + + state types.SpecState + runTime time.Duration + failure types.SpecFailure + previousFailures bool +} + +func New(subject leafnodes.SubjectNode, containers []*containernode.ContainerNode, announceProgress bool) *Spec { + spec := &Spec{ + subject: subject, + containers: containers, + focused: subject.Flag() == types.FlagTypeFocused, + announceProgress: announceProgress, + } + + spec.processFlag(subject.Flag()) + for i := len(containers) - 1; i >= 0; i-- { + spec.processFlag(containers[i].Flag()) + } + + return spec +} + +func (spec *Spec) processFlag(flag types.FlagType) { + if flag == types.FlagTypeFocused { + spec.focused = true + } else if flag == types.FlagTypePending { + spec.state = types.SpecStatePending + } +} + +func (spec *Spec) Skip() { + spec.state = types.SpecStateSkipped +} + +func (spec *Spec) Failed() bool { + return spec.state == types.SpecStateFailed || spec.state == types.SpecStatePanicked || spec.state == types.SpecStateTimedOut +} + +func (spec *Spec) Passed() bool { + return spec.state == types.SpecStatePassed +} + +func (spec *Spec) Flaked() bool { + return spec.state == types.SpecStatePassed && spec.previousFailures +} + +func (spec *Spec) Pending() bool { + return spec.state == types.SpecStatePending +} + +func (spec *Spec) Skipped() bool { + return spec.state == types.SpecStateSkipped +} + +func (spec *Spec) Focused() bool { + return spec.focused +} + +func (spec *Spec) IsMeasurement() bool { + return spec.subject.Type() == types.SpecComponentTypeMeasure +} + +func (spec *Spec) Summary(suiteID string) *types.SpecSummary { + componentTexts := make([]string, len(spec.containers)+1) + componentCodeLocations := make([]types.CodeLocation, len(spec.containers)+1) + + for i, container := range spec.containers { + componentTexts[i] = container.Text() + componentCodeLocations[i] = container.CodeLocation() + } + + componentTexts[len(spec.containers)] = spec.subject.Text() + componentCodeLocations[len(spec.containers)] = spec.subject.CodeLocation() + + return &types.SpecSummary{ + IsMeasurement: spec.IsMeasurement(), + NumberOfSamples: spec.subject.Samples(), + ComponentTexts: componentTexts, + ComponentCodeLocations: componentCodeLocations, + State: spec.state, + RunTime: spec.runTime, + Failure: spec.failure, + Measurements: spec.measurementsReport(), + SuiteID: suiteID, + } +} + +func (spec *Spec) ConcatenatedString() string { + s := "" + for _, container := range spec.containers { + s += container.Text() + " " + } + + return s + spec.subject.Text() +} + +func (spec *Spec) Run(writer io.Writer) { + if spec.state == types.SpecStateFailed { + spec.previousFailures = true + } + + startTime := time.Now() + defer func() { + spec.runTime = time.Since(startTime) + }() + + for sample := 0; sample < spec.subject.Samples(); sample++ { + spec.runSample(sample, writer) + + if spec.state != types.SpecStatePassed { + return + } + } +} + +func (spec *Spec) runSample(sample int, writer io.Writer) { + spec.state = types.SpecStatePassed + spec.failure = types.SpecFailure{} + innerMostContainerIndexToUnwind := -1 + + defer func() { + for i := innerMostContainerIndexToUnwind; i >= 0; i-- { + container := spec.containers[i] + for _, afterEach := range container.SetupNodesOfType(types.SpecComponentTypeAfterEach) { + spec.announceSetupNode(writer, "AfterEach", container, afterEach) + afterEachState, afterEachFailure := afterEach.Run() + if afterEachState != types.SpecStatePassed && spec.state == types.SpecStatePassed { + spec.state = afterEachState + spec.failure = afterEachFailure + } + } + } + }() + + for i, container := range spec.containers { + innerMostContainerIndexToUnwind = i + for _, beforeEach := range container.SetupNodesOfType(types.SpecComponentTypeBeforeEach) { + spec.announceSetupNode(writer, "BeforeEach", container, beforeEach) + spec.state, spec.failure = beforeEach.Run() + if spec.state != types.SpecStatePassed { + return + } + } + } + + for _, container := range spec.containers { + for _, justBeforeEach := range container.SetupNodesOfType(types.SpecComponentTypeJustBeforeEach) { + spec.announceSetupNode(writer, "JustBeforeEach", container, justBeforeEach) + spec.state, spec.failure = justBeforeEach.Run() + if spec.state != types.SpecStatePassed { + return + } + } + } + + spec.announceSubject(writer, spec.subject) + spec.state, spec.failure = spec.subject.Run() +} + +func (spec *Spec) announceSetupNode(writer io.Writer, nodeType string, container *containernode.ContainerNode, setupNode leafnodes.BasicNode) { + if spec.announceProgress { + s := fmt.Sprintf("[%s] %s\n %s\n", nodeType, container.Text(), setupNode.CodeLocation().String()) + writer.Write([]byte(s)) + } +} + +func (spec *Spec) announceSubject(writer io.Writer, subject leafnodes.SubjectNode) { + if spec.announceProgress { + nodeType := "" + switch subject.Type() { + case types.SpecComponentTypeIt: + nodeType = "It" + case types.SpecComponentTypeMeasure: + nodeType = "Measure" + } + s := fmt.Sprintf("[%s] %s\n %s\n", nodeType, subject.Text(), subject.CodeLocation().String()) + writer.Write([]byte(s)) + } +} + +func (spec *Spec) measurementsReport() map[string]*types.SpecMeasurement { + if !spec.IsMeasurement() || spec.Failed() { + return map[string]*types.SpecMeasurement{} + } + + return spec.subject.(*leafnodes.MeasureNode).MeasurementsReport() +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec/specs.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec/specs.go new file mode 100644 index 0000000000..006185ab5d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec/specs.go @@ -0,0 +1,123 @@ +package spec + +import ( + "math/rand" + "regexp" + "sort" +) + +type Specs struct { + specs []*Spec + hasProgrammaticFocus bool + RegexScansFilePath bool +} + +func NewSpecs(specs []*Spec) *Specs { + return &Specs{ + specs: specs, + } +} + +func (e *Specs) Specs() []*Spec { + return e.specs +} + +func (e *Specs) HasProgrammaticFocus() bool { + return e.hasProgrammaticFocus +} + +func (e *Specs) Shuffle(r *rand.Rand) { + sort.Sort(e) + permutation := r.Perm(len(e.specs)) + shuffledSpecs := make([]*Spec, len(e.specs)) + for i, j := range permutation { + shuffledSpecs[i] = e.specs[j] + } + e.specs = shuffledSpecs +} + +func (e *Specs) ApplyFocus(description string, focusString string, skipString string) { + if focusString == "" && skipString == "" { + e.applyProgrammaticFocus() + } else { + e.applyRegExpFocusAndSkip(description, focusString, skipString) + } +} + +func (e *Specs) applyProgrammaticFocus() { + e.hasProgrammaticFocus = false + for _, spec := range e.specs { + if spec.Focused() && !spec.Pending() { + e.hasProgrammaticFocus = true + break + } + } + + if e.hasProgrammaticFocus { + for _, spec := range e.specs { + if !spec.Focused() { + spec.Skip() + } + } + } +} + +// toMatch returns a byte[] to be used by regex matchers. When adding new behaviours to the matching function, +// this is the place which we append to. +func (e *Specs) toMatch(description string, spec *Spec) []byte { + if e.RegexScansFilePath { + return []byte( + description + " " + + spec.ConcatenatedString() + " " + + spec.subject.CodeLocation().FileName) + } else { + return []byte( + description + " " + + spec.ConcatenatedString()) + } +} + +func (e *Specs) applyRegExpFocusAndSkip(description string, focusString string, skipString string) { + for _, spec := range e.specs { + matchesFocus := true + matchesSkip := false + + toMatch := e.toMatch(description, spec) + + if focusString != "" { + focusFilter := regexp.MustCompile(focusString) + matchesFocus = focusFilter.Match([]byte(toMatch)) + } + + if skipString != "" { + skipFilter := regexp.MustCompile(skipString) + matchesSkip = skipFilter.Match([]byte(toMatch)) + } + + if !matchesFocus || matchesSkip { + spec.Skip() + } + } +} + +func (e *Specs) SkipMeasurements() { + for _, spec := range e.specs { + if spec.IsMeasurement() { + spec.Skip() + } + } +} + +//sort.Interface + +func (e *Specs) Len() int { + return len(e.specs) +} + +func (e *Specs) Less(i, j int) bool { + return e.specs[i].ConcatenatedString() < e.specs[j].ConcatenatedString() +} + +func (e *Specs) Swap(i, j int) { + e.specs[i], e.specs[j] = e.specs[j], e.specs[i] +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/index_computer.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/index_computer.go new file mode 100644 index 0000000000..82272554aa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/index_computer.go @@ -0,0 +1,55 @@ +package spec_iterator + +func ParallelizedIndexRange(length int, parallelTotal int, parallelNode int) (startIndex int, count int) { + if length == 0 { + return 0, 0 + } + + // We have more nodes than tests. Trivial case. + if parallelTotal >= length { + if parallelNode > length { + return 0, 0 + } else { + return parallelNode - 1, 1 + } + } + + // This is the minimum amount of tests that a node will be required to run + minTestsPerNode := length / parallelTotal + + // This is the maximum amount of tests that a node will be required to run + // The algorithm guarantees that this would be equal to at least the minimum amount + // and at most one more + maxTestsPerNode := minTestsPerNode + if length%parallelTotal != 0 { + maxTestsPerNode++ + } + + // Number of nodes that will have to run the maximum amount of tests per node + numMaxLoadNodes := length % parallelTotal + + // Number of nodes that precede the current node and will have to run the maximum amount of tests per node + var numPrecedingMaxLoadNodes int + if parallelNode > numMaxLoadNodes { + numPrecedingMaxLoadNodes = numMaxLoadNodes + } else { + numPrecedingMaxLoadNodes = parallelNode - 1 + } + + // Number of nodes that precede the current node and will have to run the minimum amount of tests per node + var numPrecedingMinLoadNodes int + if parallelNode <= numMaxLoadNodes { + numPrecedingMinLoadNodes = 0 + } else { + numPrecedingMinLoadNodes = parallelNode - numMaxLoadNodes - 1 + } + + // Evaluate the test start index and number of tests to run + startIndex = numPrecedingMaxLoadNodes*maxTestsPerNode + numPrecedingMinLoadNodes*minTestsPerNode + if parallelNode > numMaxLoadNodes { + count = minTestsPerNode + } else { + count = maxTestsPerNode + } + return +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/parallel_spec_iterator.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/parallel_spec_iterator.go new file mode 100644 index 0000000000..54e61ecb46 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/parallel_spec_iterator.go @@ -0,0 +1,60 @@ +package spec_iterator + +import ( + "encoding/json" + "errors" + "fmt" + "net/http" + + "github.com/onsi/ginkgo/internal/spec" +) + +type ParallelIterator struct { + specs []*spec.Spec + host string + client *http.Client +} + +func NewParallelIterator(specs []*spec.Spec, host string) *ParallelIterator { + return &ParallelIterator{ + specs: specs, + host: host, + client: &http.Client{}, + } +} + +func (s *ParallelIterator) Next() (*spec.Spec, error) { + resp, err := s.client.Get(s.host + "/counter") + if err != nil { + return nil, err + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, errors.New(fmt.Sprintf("unexpected status code %d", resp.StatusCode)) + } + + var counter Counter + err = json.NewDecoder(resp.Body).Decode(&counter) + if err != nil { + return nil, err + } + + if counter.Index >= len(s.specs) { + return nil, ErrClosed + } + + return s.specs[counter.Index], nil +} + +func (s *ParallelIterator) NumberOfSpecsPriorToIteration() int { + return len(s.specs) +} + +func (s *ParallelIterator) NumberOfSpecsToProcessIfKnown() (int, bool) { + return -1, false +} + +func (s *ParallelIterator) NumberOfSpecsThatWillBeRunIfKnown() (int, bool) { + return -1, false +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/serial_spec_iterator.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/serial_spec_iterator.go new file mode 100644 index 0000000000..a51c93b8b6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/serial_spec_iterator.go @@ -0,0 +1,45 @@ +package spec_iterator + +import ( + "github.com/onsi/ginkgo/internal/spec" +) + +type SerialIterator struct { + specs []*spec.Spec + index int +} + +func NewSerialIterator(specs []*spec.Spec) *SerialIterator { + return &SerialIterator{ + specs: specs, + index: 0, + } +} + +func (s *SerialIterator) Next() (*spec.Spec, error) { + if s.index >= len(s.specs) { + return nil, ErrClosed + } + + spec := s.specs[s.index] + s.index += 1 + return spec, nil +} + +func (s *SerialIterator) NumberOfSpecsPriorToIteration() int { + return len(s.specs) +} + +func (s *SerialIterator) NumberOfSpecsToProcessIfKnown() (int, bool) { + return len(s.specs), true +} + +func (s *SerialIterator) NumberOfSpecsThatWillBeRunIfKnown() (int, bool) { + count := 0 + for _, s := range s.specs { + if !s.Skipped() && !s.Pending() { + count += 1 + } + } + return count, true +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/sharded_parallel_spec_iterator.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/sharded_parallel_spec_iterator.go new file mode 100644 index 0000000000..ad4a3ea3c6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/sharded_parallel_spec_iterator.go @@ -0,0 +1,47 @@ +package spec_iterator + +import "github.com/onsi/ginkgo/internal/spec" + +type ShardedParallelIterator struct { + specs []*spec.Spec + index int + maxIndex int +} + +func NewShardedParallelIterator(specs []*spec.Spec, total int, node int) *ShardedParallelIterator { + startIndex, count := ParallelizedIndexRange(len(specs), total, node) + + return &ShardedParallelIterator{ + specs: specs, + index: startIndex, + maxIndex: startIndex + count, + } +} + +func (s *ShardedParallelIterator) Next() (*spec.Spec, error) { + if s.index >= s.maxIndex { + return nil, ErrClosed + } + + spec := s.specs[s.index] + s.index += 1 + return spec, nil +} + +func (s *ShardedParallelIterator) NumberOfSpecsPriorToIteration() int { + return len(s.specs) +} + +func (s *ShardedParallelIterator) NumberOfSpecsToProcessIfKnown() (int, bool) { + return s.maxIndex - s.index, true +} + +func (s *ShardedParallelIterator) NumberOfSpecsThatWillBeRunIfKnown() (int, bool) { + count := 0 + for i := s.index; i < s.maxIndex; i += 1 { + if !s.specs[i].Skipped() && !s.specs[i].Pending() { + count += 1 + } + } + return count, true +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/spec_iterator.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/spec_iterator.go new file mode 100644 index 0000000000..74bffad646 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/spec_iterator/spec_iterator.go @@ -0,0 +1,20 @@ +package spec_iterator + +import ( + "errors" + + "github.com/onsi/ginkgo/internal/spec" +) + +var ErrClosed = errors.New("no more specs to run") + +type SpecIterator interface { + Next() (*spec.Spec, error) + NumberOfSpecsPriorToIteration() int + NumberOfSpecsToProcessIfKnown() (int, bool) + NumberOfSpecsThatWillBeRunIfKnown() (int, bool) +} + +type Counter struct { + Index int `json:"index"` +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/specrunner/random_id.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/specrunner/random_id.go new file mode 100644 index 0000000000..a0b8b62d52 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/specrunner/random_id.go @@ -0,0 +1,15 @@ +package specrunner + +import ( + "crypto/rand" + "fmt" +) + +func randomID() string { + b := make([]byte, 8) + _, err := rand.Read(b) + if err != nil { + return "" + } + return fmt.Sprintf("%x-%x-%x-%x", b[0:2], b[2:4], b[4:6], b[6:8]) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go new file mode 100644 index 0000000000..d4dd909ecf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go @@ -0,0 +1,408 @@ +package specrunner + +import ( + "fmt" + "os" + "os/signal" + "sync" + "syscall" + + "github.com/onsi/ginkgo/internal/spec_iterator" + + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/internal/leafnodes" + "github.com/onsi/ginkgo/internal/spec" + Writer "github.com/onsi/ginkgo/internal/writer" + "github.com/onsi/ginkgo/reporters" + "github.com/onsi/ginkgo/types" + + "time" +) + +type SpecRunner struct { + description string + beforeSuiteNode leafnodes.SuiteNode + iterator spec_iterator.SpecIterator + afterSuiteNode leafnodes.SuiteNode + reporters []reporters.Reporter + startTime time.Time + suiteID string + runningSpec *spec.Spec + writer Writer.WriterInterface + config config.GinkgoConfigType + interrupted bool + processedSpecs []*spec.Spec + lock *sync.Mutex +} + +func New(description string, beforeSuiteNode leafnodes.SuiteNode, iterator spec_iterator.SpecIterator, afterSuiteNode leafnodes.SuiteNode, reporters []reporters.Reporter, writer Writer.WriterInterface, config config.GinkgoConfigType) *SpecRunner { + return &SpecRunner{ + description: description, + beforeSuiteNode: beforeSuiteNode, + iterator: iterator, + afterSuiteNode: afterSuiteNode, + reporters: reporters, + writer: writer, + config: config, + suiteID: randomID(), + lock: &sync.Mutex{}, + } +} + +func (runner *SpecRunner) Run() bool { + if runner.config.DryRun { + runner.performDryRun() + return true + } + + runner.reportSuiteWillBegin() + go runner.registerForInterrupts() + + suitePassed := runner.runBeforeSuite() + + if suitePassed { + suitePassed = runner.runSpecs() + } + + runner.blockForeverIfInterrupted() + + suitePassed = runner.runAfterSuite() && suitePassed + + runner.reportSuiteDidEnd(suitePassed) + + return suitePassed +} + +func (runner *SpecRunner) performDryRun() { + runner.reportSuiteWillBegin() + + if runner.beforeSuiteNode != nil { + summary := runner.beforeSuiteNode.Summary() + summary.State = types.SpecStatePassed + runner.reportBeforeSuite(summary) + } + + for { + spec, err := runner.iterator.Next() + if err == spec_iterator.ErrClosed { + break + } + if err != nil { + fmt.Println("failed to iterate over tests:\n" + err.Error()) + break + } + + runner.processedSpecs = append(runner.processedSpecs, spec) + + summary := spec.Summary(runner.suiteID) + runner.reportSpecWillRun(summary) + if summary.State == types.SpecStateInvalid { + summary.State = types.SpecStatePassed + } + runner.reportSpecDidComplete(summary, false) + } + + if runner.afterSuiteNode != nil { + summary := runner.afterSuiteNode.Summary() + summary.State = types.SpecStatePassed + runner.reportAfterSuite(summary) + } + + runner.reportSuiteDidEnd(true) +} + +func (runner *SpecRunner) runBeforeSuite() bool { + if runner.beforeSuiteNode == nil || runner.wasInterrupted() { + return true + } + + runner.writer.Truncate() + conf := runner.config + passed := runner.beforeSuiteNode.Run(conf.ParallelNode, conf.ParallelTotal, conf.SyncHost) + if !passed { + runner.writer.DumpOut() + } + runner.reportBeforeSuite(runner.beforeSuiteNode.Summary()) + return passed +} + +func (runner *SpecRunner) runAfterSuite() bool { + if runner.afterSuiteNode == nil { + return true + } + + runner.writer.Truncate() + conf := runner.config + passed := runner.afterSuiteNode.Run(conf.ParallelNode, conf.ParallelTotal, conf.SyncHost) + if !passed { + runner.writer.DumpOut() + } + runner.reportAfterSuite(runner.afterSuiteNode.Summary()) + return passed +} + +func (runner *SpecRunner) runSpecs() bool { + suiteFailed := false + skipRemainingSpecs := false + for { + spec, err := runner.iterator.Next() + if err == spec_iterator.ErrClosed { + break + } + if err != nil { + fmt.Println("failed to iterate over tests:\n" + err.Error()) + suiteFailed = true + break + } + + runner.processedSpecs = append(runner.processedSpecs, spec) + + if runner.wasInterrupted() { + break + } + if skipRemainingSpecs { + spec.Skip() + } + + if !spec.Skipped() && !spec.Pending() { + if passed := runner.runSpec(spec); !passed { + suiteFailed = true + } + } else if spec.Pending() && runner.config.FailOnPending { + runner.reportSpecWillRun(spec.Summary(runner.suiteID)) + suiteFailed = true + runner.reportSpecDidComplete(spec.Summary(runner.suiteID), spec.Failed()) + } else { + runner.reportSpecWillRun(spec.Summary(runner.suiteID)) + runner.reportSpecDidComplete(spec.Summary(runner.suiteID), spec.Failed()) + } + + if spec.Failed() && runner.config.FailFast { + skipRemainingSpecs = true + } + } + + return !suiteFailed +} + +func (runner *SpecRunner) runSpec(spec *spec.Spec) (passed bool) { + maxAttempts := 1 + if runner.config.FlakeAttempts > 0 { + // uninitialized configs count as 1 + maxAttempts = runner.config.FlakeAttempts + } + + for i := 0; i < maxAttempts; i++ { + runner.reportSpecWillRun(spec.Summary(runner.suiteID)) + runner.runningSpec = spec + spec.Run(runner.writer) + runner.runningSpec = nil + runner.reportSpecDidComplete(spec.Summary(runner.suiteID), spec.Failed()) + if !spec.Failed() { + return true + } + } + return false +} + +func (runner *SpecRunner) CurrentSpecSummary() (*types.SpecSummary, bool) { + if runner.runningSpec == nil { + return nil, false + } + + return runner.runningSpec.Summary(runner.suiteID), true +} + +func (runner *SpecRunner) registerForInterrupts() { + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) + + <-c + signal.Stop(c) + runner.markInterrupted() + go runner.registerForHardInterrupts() + runner.writer.DumpOutWithHeader(` +Received interrupt. Emitting contents of GinkgoWriter... +--------------------------------------------------------- +`) + if runner.afterSuiteNode != nil { + fmt.Fprint(os.Stderr, ` +--------------------------------------------------------- +Received interrupt. Running AfterSuite... +^C again to terminate immediately +`) + runner.runAfterSuite() + } + runner.reportSuiteDidEnd(false) + os.Exit(1) +} + +func (runner *SpecRunner) registerForHardInterrupts() { + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) + + <-c + fmt.Fprintln(os.Stderr, "\nReceived second interrupt. Shutting down.") + os.Exit(1) +} + +func (runner *SpecRunner) blockForeverIfInterrupted() { + runner.lock.Lock() + interrupted := runner.interrupted + runner.lock.Unlock() + + if interrupted { + select {} + } +} + +func (runner *SpecRunner) markInterrupted() { + runner.lock.Lock() + defer runner.lock.Unlock() + runner.interrupted = true +} + +func (runner *SpecRunner) wasInterrupted() bool { + runner.lock.Lock() + defer runner.lock.Unlock() + return runner.interrupted +} + +func (runner *SpecRunner) reportSuiteWillBegin() { + runner.startTime = time.Now() + summary := runner.suiteWillBeginSummary() + for _, reporter := range runner.reporters { + reporter.SpecSuiteWillBegin(runner.config, summary) + } +} + +func (runner *SpecRunner) reportBeforeSuite(summary *types.SetupSummary) { + for _, reporter := range runner.reporters { + reporter.BeforeSuiteDidRun(summary) + } +} + +func (runner *SpecRunner) reportAfterSuite(summary *types.SetupSummary) { + for _, reporter := range runner.reporters { + reporter.AfterSuiteDidRun(summary) + } +} + +func (runner *SpecRunner) reportSpecWillRun(summary *types.SpecSummary) { + runner.writer.Truncate() + + for _, reporter := range runner.reporters { + reporter.SpecWillRun(summary) + } +} + +func (runner *SpecRunner) reportSpecDidComplete(summary *types.SpecSummary, failed bool) { + if failed && len(summary.CapturedOutput) == 0 { + summary.CapturedOutput = string(runner.writer.Bytes()) + } + for i := len(runner.reporters) - 1; i >= 1; i-- { + runner.reporters[i].SpecDidComplete(summary) + } + + if failed { + runner.writer.DumpOut() + } + + runner.reporters[0].SpecDidComplete(summary) +} + +func (runner *SpecRunner) reportSuiteDidEnd(success bool) { + summary := runner.suiteDidEndSummary(success) + summary.RunTime = time.Since(runner.startTime) + for _, reporter := range runner.reporters { + reporter.SpecSuiteDidEnd(summary) + } +} + +func (runner *SpecRunner) countSpecsThatRanSatisfying(filter func(ex *spec.Spec) bool) (count int) { + count = 0 + + for _, spec := range runner.processedSpecs { + if filter(spec) { + count++ + } + } + + return count +} + +func (runner *SpecRunner) suiteDidEndSummary(success bool) *types.SuiteSummary { + numberOfSpecsThatWillBeRun := runner.countSpecsThatRanSatisfying(func(ex *spec.Spec) bool { + return !ex.Skipped() && !ex.Pending() + }) + + numberOfPendingSpecs := runner.countSpecsThatRanSatisfying(func(ex *spec.Spec) bool { + return ex.Pending() + }) + + numberOfSkippedSpecs := runner.countSpecsThatRanSatisfying(func(ex *spec.Spec) bool { + return ex.Skipped() + }) + + numberOfPassedSpecs := runner.countSpecsThatRanSatisfying(func(ex *spec.Spec) bool { + return ex.Passed() + }) + + numberOfFlakedSpecs := runner.countSpecsThatRanSatisfying(func(ex *spec.Spec) bool { + return ex.Flaked() + }) + + numberOfFailedSpecs := runner.countSpecsThatRanSatisfying(func(ex *spec.Spec) bool { + return ex.Failed() + }) + + if runner.beforeSuiteNode != nil && !runner.beforeSuiteNode.Passed() && !runner.config.DryRun { + var known bool + numberOfSpecsThatWillBeRun, known = runner.iterator.NumberOfSpecsThatWillBeRunIfKnown() + if !known { + numberOfSpecsThatWillBeRun = runner.iterator.NumberOfSpecsPriorToIteration() + } + numberOfFailedSpecs = numberOfSpecsThatWillBeRun + } + + return &types.SuiteSummary{ + SuiteDescription: runner.description, + SuiteSucceeded: success, + SuiteID: runner.suiteID, + + NumberOfSpecsBeforeParallelization: runner.iterator.NumberOfSpecsPriorToIteration(), + NumberOfTotalSpecs: len(runner.processedSpecs), + NumberOfSpecsThatWillBeRun: numberOfSpecsThatWillBeRun, + NumberOfPendingSpecs: numberOfPendingSpecs, + NumberOfSkippedSpecs: numberOfSkippedSpecs, + NumberOfPassedSpecs: numberOfPassedSpecs, + NumberOfFailedSpecs: numberOfFailedSpecs, + NumberOfFlakedSpecs: numberOfFlakedSpecs, + } +} + +func (runner *SpecRunner) suiteWillBeginSummary() *types.SuiteSummary { + numTotal, known := runner.iterator.NumberOfSpecsToProcessIfKnown() + if !known { + numTotal = -1 + } + + numToRun, known := runner.iterator.NumberOfSpecsThatWillBeRunIfKnown() + if !known { + numToRun = -1 + } + + return &types.SuiteSummary{ + SuiteDescription: runner.description, + SuiteID: runner.suiteID, + + NumberOfSpecsBeforeParallelization: runner.iterator.NumberOfSpecsPriorToIteration(), + NumberOfTotalSpecs: numTotal, + NumberOfSpecsThatWillBeRun: numToRun, + NumberOfPendingSpecs: -1, + NumberOfSkippedSpecs: -1, + NumberOfPassedSpecs: -1, + NumberOfFailedSpecs: -1, + NumberOfFlakedSpecs: -1, + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/suite/suite.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/suite/suite.go new file mode 100644 index 0000000000..698a6e5689 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/suite/suite.go @@ -0,0 +1,183 @@ +package suite + +import ( + "math/rand" + "net/http" + "time" + + "github.com/onsi/ginkgo/internal/spec_iterator" + + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/internal/containernode" + "github.com/onsi/ginkgo/internal/failer" + "github.com/onsi/ginkgo/internal/leafnodes" + "github.com/onsi/ginkgo/internal/spec" + "github.com/onsi/ginkgo/internal/specrunner" + "github.com/onsi/ginkgo/internal/writer" + "github.com/onsi/ginkgo/reporters" + "github.com/onsi/ginkgo/types" +) + +type ginkgoTestingT interface { + Fail() +} + +type Suite struct { + topLevelContainer *containernode.ContainerNode + currentContainer *containernode.ContainerNode + containerIndex int + beforeSuiteNode leafnodes.SuiteNode + afterSuiteNode leafnodes.SuiteNode + runner *specrunner.SpecRunner + failer *failer.Failer + running bool +} + +func New(failer *failer.Failer) *Suite { + topLevelContainer := containernode.New("[Top Level]", types.FlagTypeNone, types.CodeLocation{}) + + return &Suite{ + topLevelContainer: topLevelContainer, + currentContainer: topLevelContainer, + failer: failer, + containerIndex: 1, + } +} + +func (suite *Suite) Run(t ginkgoTestingT, description string, reporters []reporters.Reporter, writer writer.WriterInterface, config config.GinkgoConfigType) (bool, bool) { + if config.ParallelTotal < 1 { + panic("ginkgo.parallel.total must be >= 1") + } + + if config.ParallelNode > config.ParallelTotal || config.ParallelNode < 1 { + panic("ginkgo.parallel.node is one-indexed and must be <= ginkgo.parallel.total") + } + + r := rand.New(rand.NewSource(config.RandomSeed)) + suite.topLevelContainer.Shuffle(r) + iterator, hasProgrammaticFocus := suite.generateSpecsIterator(description, config) + suite.runner = specrunner.New(description, suite.beforeSuiteNode, iterator, suite.afterSuiteNode, reporters, writer, config) + + suite.running = true + success := suite.runner.Run() + if !success { + t.Fail() + } + return success, hasProgrammaticFocus +} + +func (suite *Suite) generateSpecsIterator(description string, config config.GinkgoConfigType) (spec_iterator.SpecIterator, bool) { + specsSlice := []*spec.Spec{} + suite.topLevelContainer.BackPropagateProgrammaticFocus() + for _, collatedNodes := range suite.topLevelContainer.Collate() { + specsSlice = append(specsSlice, spec.New(collatedNodes.Subject, collatedNodes.Containers, config.EmitSpecProgress)) + } + + specs := spec.NewSpecs(specsSlice) + specs.RegexScansFilePath = config.RegexScansFilePath + + if config.RandomizeAllSpecs { + specs.Shuffle(rand.New(rand.NewSource(config.RandomSeed))) + } + + specs.ApplyFocus(description, config.FocusString, config.SkipString) + + if config.SkipMeasurements { + specs.SkipMeasurements() + } + + var iterator spec_iterator.SpecIterator + + if config.ParallelTotal > 1 { + iterator = spec_iterator.NewParallelIterator(specs.Specs(), config.SyncHost) + resp, err := http.Get(config.SyncHost + "/has-counter") + if err != nil || resp.StatusCode != http.StatusOK { + iterator = spec_iterator.NewShardedParallelIterator(specs.Specs(), config.ParallelTotal, config.ParallelNode) + } + } else { + iterator = spec_iterator.NewSerialIterator(specs.Specs()) + } + + return iterator, specs.HasProgrammaticFocus() +} + +func (suite *Suite) CurrentRunningSpecSummary() (*types.SpecSummary, bool) { + return suite.runner.CurrentSpecSummary() +} + +func (suite *Suite) SetBeforeSuiteNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration) { + if suite.beforeSuiteNode != nil { + panic("You may only call BeforeSuite once!") + } + suite.beforeSuiteNode = leafnodes.NewBeforeSuiteNode(body, codeLocation, timeout, suite.failer) +} + +func (suite *Suite) SetAfterSuiteNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration) { + if suite.afterSuiteNode != nil { + panic("You may only call AfterSuite once!") + } + suite.afterSuiteNode = leafnodes.NewAfterSuiteNode(body, codeLocation, timeout, suite.failer) +} + +func (suite *Suite) SetSynchronizedBeforeSuiteNode(bodyA interface{}, bodyB interface{}, codeLocation types.CodeLocation, timeout time.Duration) { + if suite.beforeSuiteNode != nil { + panic("You may only call BeforeSuite once!") + } + suite.beforeSuiteNode = leafnodes.NewSynchronizedBeforeSuiteNode(bodyA, bodyB, codeLocation, timeout, suite.failer) +} + +func (suite *Suite) SetSynchronizedAfterSuiteNode(bodyA interface{}, bodyB interface{}, codeLocation types.CodeLocation, timeout time.Duration) { + if suite.afterSuiteNode != nil { + panic("You may only call AfterSuite once!") + } + suite.afterSuiteNode = leafnodes.NewSynchronizedAfterSuiteNode(bodyA, bodyB, codeLocation, timeout, suite.failer) +} + +func (suite *Suite) PushContainerNode(text string, body func(), flag types.FlagType, codeLocation types.CodeLocation) { + container := containernode.New(text, flag, codeLocation) + suite.currentContainer.PushContainerNode(container) + + previousContainer := suite.currentContainer + suite.currentContainer = container + suite.containerIndex++ + + body() + + suite.containerIndex-- + suite.currentContainer = previousContainer +} + +func (suite *Suite) PushItNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, timeout time.Duration) { + if suite.running { + suite.failer.Fail("You may only call It from within a Describe or Context", codeLocation) + } + suite.currentContainer.PushSubjectNode(leafnodes.NewItNode(text, body, flag, codeLocation, timeout, suite.failer, suite.containerIndex)) +} + +func (suite *Suite) PushMeasureNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, samples int) { + if suite.running { + suite.failer.Fail("You may only call Measure from within a Describe or Context", codeLocation) + } + suite.currentContainer.PushSubjectNode(leafnodes.NewMeasureNode(text, body, flag, codeLocation, samples, suite.failer, suite.containerIndex)) +} + +func (suite *Suite) PushBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration) { + if suite.running { + suite.failer.Fail("You may only call BeforeEach from within a Describe or Context", codeLocation) + } + suite.currentContainer.PushSetupNode(leafnodes.NewBeforeEachNode(body, codeLocation, timeout, suite.failer, suite.containerIndex)) +} + +func (suite *Suite) PushJustBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration) { + if suite.running { + suite.failer.Fail("You may only call JustBeforeEach from within a Describe or Context", codeLocation) + } + suite.currentContainer.PushSetupNode(leafnodes.NewJustBeforeEachNode(body, codeLocation, timeout, suite.failer, suite.containerIndex)) +} + +func (suite *Suite) PushAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration) { + if suite.running { + suite.failer.Fail("You may only call AfterEach from within a Describe or Context", codeLocation) + } + suite.currentContainer.PushSetupNode(leafnodes.NewAfterEachNode(body, codeLocation, timeout, suite.failer, suite.containerIndex)) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go new file mode 100644 index 0000000000..090445d084 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go @@ -0,0 +1,76 @@ +package testingtproxy + +import ( + "fmt" + "io" +) + +type failFunc func(message string, callerSkip ...int) + +func New(writer io.Writer, fail failFunc, offset int) *ginkgoTestingTProxy { + return &ginkgoTestingTProxy{ + fail: fail, + offset: offset, + writer: writer, + } +} + +type ginkgoTestingTProxy struct { + fail failFunc + offset int + writer io.Writer +} + +func (t *ginkgoTestingTProxy) Error(args ...interface{}) { + t.fail(fmt.Sprintln(args...), t.offset) +} + +func (t *ginkgoTestingTProxy) Errorf(format string, args ...interface{}) { + t.fail(fmt.Sprintf(format, args...), t.offset) +} + +func (t *ginkgoTestingTProxy) Fail() { + t.fail("failed", t.offset) +} + +func (t *ginkgoTestingTProxy) FailNow() { + t.fail("failed", t.offset) +} + +func (t *ginkgoTestingTProxy) Fatal(args ...interface{}) { + t.fail(fmt.Sprintln(args...), t.offset) +} + +func (t *ginkgoTestingTProxy) Fatalf(format string, args ...interface{}) { + t.fail(fmt.Sprintf(format, args...), t.offset) +} + +func (t *ginkgoTestingTProxy) Log(args ...interface{}) { + fmt.Fprintln(t.writer, args...) +} + +func (t *ginkgoTestingTProxy) Logf(format string, args ...interface{}) { + t.Log(fmt.Sprintf(format, args...)) +} + +func (t *ginkgoTestingTProxy) Failed() bool { + return false +} + +func (t *ginkgoTestingTProxy) Parallel() { +} + +func (t *ginkgoTestingTProxy) Skip(args ...interface{}) { + fmt.Println(args...) +} + +func (t *ginkgoTestingTProxy) Skipf(format string, args ...interface{}) { + t.Skip(fmt.Sprintf(format, args...)) +} + +func (t *ginkgoTestingTProxy) SkipNow() { +} + +func (t *ginkgoTestingTProxy) Skipped() bool { + return false +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/writer/fake_writer.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/writer/fake_writer.go new file mode 100644 index 0000000000..6739c3f605 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/writer/fake_writer.go @@ -0,0 +1,36 @@ +package writer + +type FakeGinkgoWriter struct { + EventStream []string +} + +func NewFake() *FakeGinkgoWriter { + return &FakeGinkgoWriter{ + EventStream: []string{}, + } +} + +func (writer *FakeGinkgoWriter) AddEvent(event string) { + writer.EventStream = append(writer.EventStream, event) +} + +func (writer *FakeGinkgoWriter) Truncate() { + writer.EventStream = append(writer.EventStream, "TRUNCATE") +} + +func (writer *FakeGinkgoWriter) DumpOut() { + writer.EventStream = append(writer.EventStream, "DUMP") +} + +func (writer *FakeGinkgoWriter) DumpOutWithHeader(header string) { + writer.EventStream = append(writer.EventStream, "DUMP_WITH_HEADER: "+header) +} + +func (writer *FakeGinkgoWriter) Bytes() []byte { + writer.EventStream = append(writer.EventStream, "BYTES") + return nil +} + +func (writer *FakeGinkgoWriter) Write(data []byte) (n int, err error) { + return 0, nil +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/writer/writer.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/writer/writer.go new file mode 100644 index 0000000000..6b23b1a648 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/internal/writer/writer.go @@ -0,0 +1,81 @@ +package writer + +import ( + "bytes" + "io" + "sync" +) + +type WriterInterface interface { + io.Writer + + Truncate() + DumpOut() + DumpOutWithHeader(header string) + Bytes() []byte +} + +type Writer struct { + buffer *bytes.Buffer + outWriter io.Writer + lock *sync.Mutex + stream bool +} + +func New(outWriter io.Writer) *Writer { + return &Writer{ + buffer: &bytes.Buffer{}, + lock: &sync.Mutex{}, + outWriter: outWriter, + stream: true, + } +} + +func (w *Writer) SetStream(stream bool) { + w.lock.Lock() + defer w.lock.Unlock() + w.stream = stream +} + +func (w *Writer) Write(b []byte) (n int, err error) { + w.lock.Lock() + defer w.lock.Unlock() + + n, err = w.buffer.Write(b) + if w.stream { + return w.outWriter.Write(b) + } + return n, err +} + +func (w *Writer) Truncate() { + w.lock.Lock() + defer w.lock.Unlock() + w.buffer.Reset() +} + +func (w *Writer) DumpOut() { + w.lock.Lock() + defer w.lock.Unlock() + if !w.stream { + w.buffer.WriteTo(w.outWriter) + } +} + +func (w *Writer) Bytes() []byte { + w.lock.Lock() + defer w.lock.Unlock() + b := w.buffer.Bytes() + copied := make([]byte, len(b)) + copy(copied, b) + return copied +} + +func (w *Writer) DumpOutWithHeader(header string) { + w.lock.Lock() + defer w.lock.Unlock() + if !w.stream && w.buffer.Len() > 0 { + w.outWriter.Write([]byte(header)) + w.buffer.WriteTo(w.outWriter) + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/default_reporter.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/default_reporter.go new file mode 100644 index 0000000000..fb82f70a6d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/default_reporter.go @@ -0,0 +1,84 @@ +/* +Ginkgo's Default Reporter + +A number of command line flags are available to tweak Ginkgo's default output. + +These are documented [here](http://onsi.github.io/ginkgo/#running_tests) +*/ +package reporters + +import ( + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/reporters/stenographer" + "github.com/onsi/ginkgo/types" +) + +type DefaultReporter struct { + config config.DefaultReporterConfigType + stenographer stenographer.Stenographer + specSummaries []*types.SpecSummary +} + +func NewDefaultReporter(config config.DefaultReporterConfigType, stenographer stenographer.Stenographer) *DefaultReporter { + return &DefaultReporter{ + config: config, + stenographer: stenographer, + } +} + +func (reporter *DefaultReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) { + reporter.stenographer.AnnounceSuite(summary.SuiteDescription, config.RandomSeed, config.RandomizeAllSpecs, reporter.config.Succinct) + if config.ParallelTotal > 1 { + reporter.stenographer.AnnounceParallelRun(config.ParallelNode, config.ParallelTotal, reporter.config.Succinct) + } else { + reporter.stenographer.AnnounceNumberOfSpecs(summary.NumberOfSpecsThatWillBeRun, summary.NumberOfTotalSpecs, reporter.config.Succinct) + } +} + +func (reporter *DefaultReporter) BeforeSuiteDidRun(setupSummary *types.SetupSummary) { + if setupSummary.State != types.SpecStatePassed { + reporter.stenographer.AnnounceBeforeSuiteFailure(setupSummary, reporter.config.Succinct, reporter.config.FullTrace) + } +} + +func (reporter *DefaultReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary) { + if setupSummary.State != types.SpecStatePassed { + reporter.stenographer.AnnounceAfterSuiteFailure(setupSummary, reporter.config.Succinct, reporter.config.FullTrace) + } +} + +func (reporter *DefaultReporter) SpecWillRun(specSummary *types.SpecSummary) { + if reporter.config.Verbose && !reporter.config.Succinct && specSummary.State != types.SpecStatePending && specSummary.State != types.SpecStateSkipped { + reporter.stenographer.AnnounceSpecWillRun(specSummary) + } +} + +func (reporter *DefaultReporter) SpecDidComplete(specSummary *types.SpecSummary) { + switch specSummary.State { + case types.SpecStatePassed: + if specSummary.IsMeasurement { + reporter.stenographer.AnnounceSuccesfulMeasurement(specSummary, reporter.config.Succinct) + } else if specSummary.RunTime.Seconds() >= reporter.config.SlowSpecThreshold { + reporter.stenographer.AnnounceSuccesfulSlowSpec(specSummary, reporter.config.Succinct) + } else { + reporter.stenographer.AnnounceSuccesfulSpec(specSummary) + } + case types.SpecStatePending: + reporter.stenographer.AnnouncePendingSpec(specSummary, reporter.config.NoisyPendings && !reporter.config.Succinct) + case types.SpecStateSkipped: + reporter.stenographer.AnnounceSkippedSpec(specSummary, reporter.config.Succinct, reporter.config.FullTrace) + case types.SpecStateTimedOut: + reporter.stenographer.AnnounceSpecTimedOut(specSummary, reporter.config.Succinct, reporter.config.FullTrace) + case types.SpecStatePanicked: + reporter.stenographer.AnnounceSpecPanicked(specSummary, reporter.config.Succinct, reporter.config.FullTrace) + case types.SpecStateFailed: + reporter.stenographer.AnnounceSpecFailed(specSummary, reporter.config.Succinct, reporter.config.FullTrace) + } + + reporter.specSummaries = append(reporter.specSummaries, specSummary) +} + +func (reporter *DefaultReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) { + reporter.stenographer.SummarizeFailures(reporter.specSummaries) + reporter.stenographer.AnnounceSpecRunCompletion(summary, reporter.config.Succinct) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go new file mode 100644 index 0000000000..27db479490 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go @@ -0,0 +1,59 @@ +package reporters + +import ( + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/types" +) + +//FakeReporter is useful for testing purposes +type FakeReporter struct { + Config config.GinkgoConfigType + + BeginSummary *types.SuiteSummary + BeforeSuiteSummary *types.SetupSummary + SpecWillRunSummaries []*types.SpecSummary + SpecSummaries []*types.SpecSummary + AfterSuiteSummary *types.SetupSummary + EndSummary *types.SuiteSummary + + SpecWillRunStub func(specSummary *types.SpecSummary) + SpecDidCompleteStub func(specSummary *types.SpecSummary) +} + +func NewFakeReporter() *FakeReporter { + return &FakeReporter{ + SpecWillRunSummaries: make([]*types.SpecSummary, 0), + SpecSummaries: make([]*types.SpecSummary, 0), + } +} + +func (fakeR *FakeReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) { + fakeR.Config = config + fakeR.BeginSummary = summary +} + +func (fakeR *FakeReporter) BeforeSuiteDidRun(setupSummary *types.SetupSummary) { + fakeR.BeforeSuiteSummary = setupSummary +} + +func (fakeR *FakeReporter) SpecWillRun(specSummary *types.SpecSummary) { + if fakeR.SpecWillRunStub != nil { + fakeR.SpecWillRunStub(specSummary) + } + fakeR.SpecWillRunSummaries = append(fakeR.SpecWillRunSummaries, specSummary) +} + +func (fakeR *FakeReporter) SpecDidComplete(specSummary *types.SpecSummary) { + if fakeR.SpecDidCompleteStub != nil { + fakeR.SpecDidCompleteStub(specSummary) + } + fakeR.SpecSummaries = append(fakeR.SpecSummaries, specSummary) +} + +func (fakeR *FakeReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary) { + fakeR.AfterSuiteSummary = setupSummary +} + +func (fakeR *FakeReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) { + fakeR.EndSummary = summary +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go new file mode 100644 index 0000000000..89b03513fd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go @@ -0,0 +1,147 @@ +/* + +JUnit XML Reporter for Ginkgo + +For usage instructions: http://onsi.github.io/ginkgo/#generating_junit_xml_output + +*/ + +package reporters + +import ( + "encoding/xml" + "fmt" + "os" + "strings" + + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/types" +) + +type JUnitTestSuite struct { + XMLName xml.Name `xml:"testsuite"` + TestCases []JUnitTestCase `xml:"testcase"` + Tests int `xml:"tests,attr"` + Failures int `xml:"failures,attr"` + Time float64 `xml:"time,attr"` +} + +type JUnitTestCase struct { + Name string `xml:"name,attr"` + ClassName string `xml:"classname,attr"` + FailureMessage *JUnitFailureMessage `xml:"failure,omitempty"` + Skipped *JUnitSkipped `xml:"skipped,omitempty"` + Time float64 `xml:"time,attr"` + SystemOut string `xml:"system-out,omitempty"` +} + +type JUnitFailureMessage struct { + Type string `xml:"type,attr"` + Message string `xml:",chardata"` +} + +type JUnitSkipped struct { + XMLName xml.Name `xml:"skipped"` +} + +type JUnitReporter struct { + suite JUnitTestSuite + filename string + testSuiteName string +} + +//NewJUnitReporter creates a new JUnit XML reporter. The XML will be stored in the passed in filename. +func NewJUnitReporter(filename string) *JUnitReporter { + return &JUnitReporter{ + filename: filename, + } +} + +func (reporter *JUnitReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) { + reporter.suite = JUnitTestSuite{ + TestCases: []JUnitTestCase{}, + } + reporter.testSuiteName = summary.SuiteDescription +} + +func (reporter *JUnitReporter) SpecWillRun(specSummary *types.SpecSummary) { +} + +func (reporter *JUnitReporter) BeforeSuiteDidRun(setupSummary *types.SetupSummary) { + reporter.handleSetupSummary("BeforeSuite", setupSummary) +} + +func (reporter *JUnitReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary) { + reporter.handleSetupSummary("AfterSuite", setupSummary) +} + +func failureMessage(failure types.SpecFailure) string { + return fmt.Sprintf("%s\n%s\n%s", failure.ComponentCodeLocation.String(), failure.Message, failure.Location.String()) +} + +func (reporter *JUnitReporter) handleSetupSummary(name string, setupSummary *types.SetupSummary) { + if setupSummary.State != types.SpecStatePassed { + testCase := JUnitTestCase{ + Name: name, + ClassName: reporter.testSuiteName, + } + + testCase.FailureMessage = &JUnitFailureMessage{ + Type: reporter.failureTypeForState(setupSummary.State), + Message: failureMessage(setupSummary.Failure), + } + testCase.SystemOut = setupSummary.CapturedOutput + testCase.Time = setupSummary.RunTime.Seconds() + reporter.suite.TestCases = append(reporter.suite.TestCases, testCase) + } +} + +func (reporter *JUnitReporter) SpecDidComplete(specSummary *types.SpecSummary) { + testCase := JUnitTestCase{ + Name: strings.Join(specSummary.ComponentTexts[1:], " "), + ClassName: reporter.testSuiteName, + } + if specSummary.State == types.SpecStateFailed || specSummary.State == types.SpecStateTimedOut || specSummary.State == types.SpecStatePanicked { + testCase.FailureMessage = &JUnitFailureMessage{ + Type: reporter.failureTypeForState(specSummary.State), + Message: failureMessage(specSummary.Failure), + } + testCase.SystemOut = specSummary.CapturedOutput + } + if specSummary.State == types.SpecStateSkipped || specSummary.State == types.SpecStatePending { + testCase.Skipped = &JUnitSkipped{} + } + testCase.Time = specSummary.RunTime.Seconds() + reporter.suite.TestCases = append(reporter.suite.TestCases, testCase) +} + +func (reporter *JUnitReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) { + reporter.suite.Tests = summary.NumberOfSpecsThatWillBeRun + reporter.suite.Time = summary.RunTime.Seconds() + reporter.suite.Failures = summary.NumberOfFailedSpecs + file, err := os.Create(reporter.filename) + if err != nil { + fmt.Printf("Failed to create JUnit report file: %s\n\t%s", reporter.filename, err.Error()) + } + defer file.Close() + file.WriteString(xml.Header) + encoder := xml.NewEncoder(file) + encoder.Indent(" ", " ") + err = encoder.Encode(reporter.suite) + if err != nil { + fmt.Printf("Failed to generate JUnit report\n\t%s", err.Error()) + } +} + +func (reporter *JUnitReporter) failureTypeForState(state types.SpecState) string { + switch state { + case types.SpecStateFailed: + return "Failure" + case types.SpecStateTimedOut: + return "Timeout" + case types.SpecStatePanicked: + return "Panic" + default: + return "" + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/reporter.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/reporter.go new file mode 100644 index 0000000000..348b9dfce1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/reporter.go @@ -0,0 +1,15 @@ +package reporters + +import ( + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/types" +) + +type Reporter interface { + SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) + BeforeSuiteDidRun(setupSummary *types.SetupSummary) + SpecWillRun(specSummary *types.SpecSummary) + SpecDidComplete(specSummary *types.SpecSummary) + AfterSuiteDidRun(setupSummary *types.SetupSummary) + SpecSuiteDidEnd(summary *types.SuiteSummary) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/console_logging.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/console_logging.go new file mode 100644 index 0000000000..45b8f88690 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/console_logging.go @@ -0,0 +1,64 @@ +package stenographer + +import ( + "fmt" + "strings" +) + +func (s *consoleStenographer) colorize(colorCode string, format string, args ...interface{}) string { + var out string + + if len(args) > 0 { + out = fmt.Sprintf(format, args...) + } else { + out = format + } + + if s.color { + return fmt.Sprintf("%s%s%s", colorCode, out, defaultStyle) + } else { + return out + } +} + +func (s *consoleStenographer) printBanner(text string, bannerCharacter string) { + fmt.Fprintln(s.w, text) + fmt.Fprintln(s.w, strings.Repeat(bannerCharacter, len(text))) +} + +func (s *consoleStenographer) printNewLine() { + fmt.Fprintln(s.w, "") +} + +func (s *consoleStenographer) printDelimiter() { + fmt.Fprintln(s.w, s.colorize(grayColor, "%s", strings.Repeat("-", 30))) +} + +func (s *consoleStenographer) print(indentation int, format string, args ...interface{}) { + fmt.Fprint(s.w, s.indent(indentation, format, args...)) +} + +func (s *consoleStenographer) println(indentation int, format string, args ...interface{}) { + fmt.Fprintln(s.w, s.indent(indentation, format, args...)) +} + +func (s *consoleStenographer) indent(indentation int, format string, args ...interface{}) string { + var text string + + if len(args) > 0 { + text = fmt.Sprintf(format, args...) + } else { + text = format + } + + stringArray := strings.Split(text, "\n") + padding := "" + if indentation >= 0 { + padding = strings.Repeat(" ", indentation) + } + for i, s := range stringArray { + stringArray[i] = fmt.Sprintf("%s%s", padding, s) + } + + return strings.Join(stringArray, "\n") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/fake_stenographer.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/fake_stenographer.go new file mode 100644 index 0000000000..98854e7d9a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/fake_stenographer.go @@ -0,0 +1,142 @@ +package stenographer + +import ( + "sync" + + "github.com/onsi/ginkgo/types" +) + +func NewFakeStenographerCall(method string, args ...interface{}) FakeStenographerCall { + return FakeStenographerCall{ + Method: method, + Args: args, + } +} + +type FakeStenographer struct { + calls []FakeStenographerCall + lock *sync.Mutex +} + +type FakeStenographerCall struct { + Method string + Args []interface{} +} + +func NewFakeStenographer() *FakeStenographer { + stenographer := &FakeStenographer{ + lock: &sync.Mutex{}, + } + stenographer.Reset() + return stenographer +} + +func (stenographer *FakeStenographer) Calls() []FakeStenographerCall { + stenographer.lock.Lock() + defer stenographer.lock.Unlock() + + return stenographer.calls +} + +func (stenographer *FakeStenographer) Reset() { + stenographer.lock.Lock() + defer stenographer.lock.Unlock() + + stenographer.calls = make([]FakeStenographerCall, 0) +} + +func (stenographer *FakeStenographer) CallsTo(method string) []FakeStenographerCall { + stenographer.lock.Lock() + defer stenographer.lock.Unlock() + + results := make([]FakeStenographerCall, 0) + for _, call := range stenographer.calls { + if call.Method == method { + results = append(results, call) + } + } + + return results +} + +func (stenographer *FakeStenographer) registerCall(method string, args ...interface{}) { + stenographer.lock.Lock() + defer stenographer.lock.Unlock() + + stenographer.calls = append(stenographer.calls, NewFakeStenographerCall(method, args...)) +} + +func (stenographer *FakeStenographer) AnnounceSuite(description string, randomSeed int64, randomizingAll bool, succinct bool) { + stenographer.registerCall("AnnounceSuite", description, randomSeed, randomizingAll, succinct) +} + +func (stenographer *FakeStenographer) AnnounceAggregatedParallelRun(nodes int, succinct bool) { + stenographer.registerCall("AnnounceAggregatedParallelRun", nodes, succinct) +} + +func (stenographer *FakeStenographer) AnnounceParallelRun(node int, nodes int, succinct bool) { + stenographer.registerCall("AnnounceParallelRun", node, nodes, succinct) +} + +func (stenographer *FakeStenographer) AnnounceNumberOfSpecs(specsToRun int, total int, succinct bool) { + stenographer.registerCall("AnnounceNumberOfSpecs", specsToRun, total, succinct) +} + +func (stenographer *FakeStenographer) AnnounceTotalNumberOfSpecs(total int, succinct bool) { + stenographer.registerCall("AnnounceTotalNumberOfSpecs", total, succinct) +} + +func (stenographer *FakeStenographer) AnnounceSpecRunCompletion(summary *types.SuiteSummary, succinct bool) { + stenographer.registerCall("AnnounceSpecRunCompletion", summary, succinct) +} + +func (stenographer *FakeStenographer) AnnounceSpecWillRun(spec *types.SpecSummary) { + stenographer.registerCall("AnnounceSpecWillRun", spec) +} + +func (stenographer *FakeStenographer) AnnounceBeforeSuiteFailure(summary *types.SetupSummary, succinct bool, fullTrace bool) { + stenographer.registerCall("AnnounceBeforeSuiteFailure", summary, succinct, fullTrace) +} + +func (stenographer *FakeStenographer) AnnounceAfterSuiteFailure(summary *types.SetupSummary, succinct bool, fullTrace bool) { + stenographer.registerCall("AnnounceAfterSuiteFailure", summary, succinct, fullTrace) +} +func (stenographer *FakeStenographer) AnnounceCapturedOutput(output string) { + stenographer.registerCall("AnnounceCapturedOutput", output) +} + +func (stenographer *FakeStenographer) AnnounceSuccesfulSpec(spec *types.SpecSummary) { + stenographer.registerCall("AnnounceSuccesfulSpec", spec) +} + +func (stenographer *FakeStenographer) AnnounceSuccesfulSlowSpec(spec *types.SpecSummary, succinct bool) { + stenographer.registerCall("AnnounceSuccesfulSlowSpec", spec, succinct) +} + +func (stenographer *FakeStenographer) AnnounceSuccesfulMeasurement(spec *types.SpecSummary, succinct bool) { + stenographer.registerCall("AnnounceSuccesfulMeasurement", spec, succinct) +} + +func (stenographer *FakeStenographer) AnnouncePendingSpec(spec *types.SpecSummary, noisy bool) { + stenographer.registerCall("AnnouncePendingSpec", spec, noisy) +} + +func (stenographer *FakeStenographer) AnnounceSkippedSpec(spec *types.SpecSummary, succinct bool, fullTrace bool) { + stenographer.registerCall("AnnounceSkippedSpec", spec, succinct, fullTrace) +} + +func (stenographer *FakeStenographer) AnnounceSpecTimedOut(spec *types.SpecSummary, succinct bool, fullTrace bool) { + stenographer.registerCall("AnnounceSpecTimedOut", spec, succinct, fullTrace) +} + +func (stenographer *FakeStenographer) AnnounceSpecPanicked(spec *types.SpecSummary, succinct bool, fullTrace bool) { + stenographer.registerCall("AnnounceSpecPanicked", spec, succinct, fullTrace) +} + +func (stenographer *FakeStenographer) AnnounceSpecFailed(spec *types.SpecSummary, succinct bool, fullTrace bool) { + stenographer.registerCall("AnnounceSpecFailed", spec, succinct, fullTrace) +} + +func (stenographer *FakeStenographer) SummarizeFailures(summaries []*types.SpecSummary) { + stenographer.registerCall("SummarizeFailures", summaries) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/stenographer.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/stenographer.go new file mode 100644 index 0000000000..fefd3e182f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/stenographer.go @@ -0,0 +1,573 @@ +/* +The stenographer is used by Ginkgo's reporters to generate output. + +Move along, nothing to see here. +*/ + +package stenographer + +import ( + "fmt" + "io" + "runtime" + "strings" + + "github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable" + "github.com/onsi/ginkgo/types" +) + +const defaultStyle = "\x1b[0m" +const boldStyle = "\x1b[1m" +const redColor = "\x1b[91m" +const greenColor = "\x1b[32m" +const yellowColor = "\x1b[33m" +const cyanColor = "\x1b[36m" +const grayColor = "\x1b[90m" +const lightGrayColor = "\x1b[37m" + +type cursorStateType int + +const ( + cursorStateTop cursorStateType = iota + cursorStateStreaming + cursorStateMidBlock + cursorStateEndBlock +) + +type Stenographer interface { + AnnounceSuite(description string, randomSeed int64, randomizingAll bool, succinct bool) + AnnounceAggregatedParallelRun(nodes int, succinct bool) + AnnounceParallelRun(node int, nodes int, succinct bool) + AnnounceTotalNumberOfSpecs(total int, succinct bool) + AnnounceNumberOfSpecs(specsToRun int, total int, succinct bool) + AnnounceSpecRunCompletion(summary *types.SuiteSummary, succinct bool) + + AnnounceSpecWillRun(spec *types.SpecSummary) + AnnounceBeforeSuiteFailure(summary *types.SetupSummary, succinct bool, fullTrace bool) + AnnounceAfterSuiteFailure(summary *types.SetupSummary, succinct bool, fullTrace bool) + + AnnounceCapturedOutput(output string) + + AnnounceSuccesfulSpec(spec *types.SpecSummary) + AnnounceSuccesfulSlowSpec(spec *types.SpecSummary, succinct bool) + AnnounceSuccesfulMeasurement(spec *types.SpecSummary, succinct bool) + + AnnouncePendingSpec(spec *types.SpecSummary, noisy bool) + AnnounceSkippedSpec(spec *types.SpecSummary, succinct bool, fullTrace bool) + + AnnounceSpecTimedOut(spec *types.SpecSummary, succinct bool, fullTrace bool) + AnnounceSpecPanicked(spec *types.SpecSummary, succinct bool, fullTrace bool) + AnnounceSpecFailed(spec *types.SpecSummary, succinct bool, fullTrace bool) + + SummarizeFailures(summaries []*types.SpecSummary) +} + +func New(color bool, enableFlakes bool) Stenographer { + denoter := "•" + if runtime.GOOS == "windows" { + denoter = "+" + } + return &consoleStenographer{ + color: color, + denoter: denoter, + cursorState: cursorStateTop, + enableFlakes: enableFlakes, + w: colorable.NewColorableStdout(), + } +} + +type consoleStenographer struct { + color bool + denoter string + cursorState cursorStateType + enableFlakes bool + w io.Writer +} + +var alternatingColors = []string{defaultStyle, grayColor} + +func (s *consoleStenographer) AnnounceSuite(description string, randomSeed int64, randomizingAll bool, succinct bool) { + if succinct { + s.print(0, "[%d] %s ", randomSeed, s.colorize(boldStyle, description)) + return + } + s.printBanner(fmt.Sprintf("Running Suite: %s", description), "=") + s.print(0, "Random Seed: %s", s.colorize(boldStyle, "%d", randomSeed)) + if randomizingAll { + s.print(0, " - Will randomize all specs") + } + s.printNewLine() +} + +func (s *consoleStenographer) AnnounceParallelRun(node int, nodes int, succinct bool) { + if succinct { + s.print(0, "- node #%d ", node) + return + } + s.println(0, + "Parallel test node %s/%s.", + s.colorize(boldStyle, "%d", node), + s.colorize(boldStyle, "%d", nodes), + ) + s.printNewLine() +} + +func (s *consoleStenographer) AnnounceAggregatedParallelRun(nodes int, succinct bool) { + if succinct { + s.print(0, "- %d nodes ", nodes) + return + } + s.println(0, + "Running in parallel across %s nodes", + s.colorize(boldStyle, "%d", nodes), + ) + s.printNewLine() +} + +func (s *consoleStenographer) AnnounceNumberOfSpecs(specsToRun int, total int, succinct bool) { + if succinct { + s.print(0, "- %d/%d specs ", specsToRun, total) + s.stream() + return + } + s.println(0, + "Will run %s of %s specs", + s.colorize(boldStyle, "%d", specsToRun), + s.colorize(boldStyle, "%d", total), + ) + + s.printNewLine() +} + +func (s *consoleStenographer) AnnounceTotalNumberOfSpecs(total int, succinct bool) { + if succinct { + s.print(0, "- %d specs ", total) + s.stream() + return + } + s.println(0, + "Will run %s specs", + s.colorize(boldStyle, "%d", total), + ) + + s.printNewLine() +} + +func (s *consoleStenographer) AnnounceSpecRunCompletion(summary *types.SuiteSummary, succinct bool) { + if succinct && summary.SuiteSucceeded { + s.print(0, " %s %s ", s.colorize(greenColor, "SUCCESS!"), summary.RunTime) + return + } + s.printNewLine() + color := greenColor + if !summary.SuiteSucceeded { + color = redColor + } + s.println(0, s.colorize(boldStyle+color, "Ran %d of %d Specs in %.3f seconds", summary.NumberOfSpecsThatWillBeRun, summary.NumberOfTotalSpecs, summary.RunTime.Seconds())) + + status := "" + if summary.SuiteSucceeded { + status = s.colorize(boldStyle+greenColor, "SUCCESS!") + } else { + status = s.colorize(boldStyle+redColor, "FAIL!") + } + + flakes := "" + if s.enableFlakes { + flakes = " | " + s.colorize(yellowColor+boldStyle, "%d Flaked", summary.NumberOfFlakedSpecs) + } + + s.print(0, + "%s -- %s | %s | %s | %s ", + status, + s.colorize(greenColor+boldStyle, "%d Passed", summary.NumberOfPassedSpecs), + s.colorize(redColor+boldStyle, "%d Failed", summary.NumberOfFailedSpecs)+flakes, + s.colorize(yellowColor+boldStyle, "%d Pending", summary.NumberOfPendingSpecs), + s.colorize(cyanColor+boldStyle, "%d Skipped", summary.NumberOfSkippedSpecs), + ) +} + +func (s *consoleStenographer) AnnounceSpecWillRun(spec *types.SpecSummary) { + s.startBlock() + for i, text := range spec.ComponentTexts[1 : len(spec.ComponentTexts)-1] { + s.print(0, s.colorize(alternatingColors[i%2], text)+" ") + } + + indentation := 0 + if len(spec.ComponentTexts) > 2 { + indentation = 1 + s.printNewLine() + } + index := len(spec.ComponentTexts) - 1 + s.print(indentation, s.colorize(boldStyle, spec.ComponentTexts[index])) + s.printNewLine() + s.print(indentation, s.colorize(lightGrayColor, spec.ComponentCodeLocations[index].String())) + s.printNewLine() + s.midBlock() +} + +func (s *consoleStenographer) AnnounceBeforeSuiteFailure(summary *types.SetupSummary, succinct bool, fullTrace bool) { + s.announceSetupFailure("BeforeSuite", summary, succinct, fullTrace) +} + +func (s *consoleStenographer) AnnounceAfterSuiteFailure(summary *types.SetupSummary, succinct bool, fullTrace bool) { + s.announceSetupFailure("AfterSuite", summary, succinct, fullTrace) +} + +func (s *consoleStenographer) announceSetupFailure(name string, summary *types.SetupSummary, succinct bool, fullTrace bool) { + s.startBlock() + var message string + switch summary.State { + case types.SpecStateFailed: + message = "Failure" + case types.SpecStatePanicked: + message = "Panic" + case types.SpecStateTimedOut: + message = "Timeout" + } + + s.println(0, s.colorize(redColor+boldStyle, "%s [%.3f seconds]", message, summary.RunTime.Seconds())) + + indentation := s.printCodeLocationBlock([]string{name}, []types.CodeLocation{summary.CodeLocation}, summary.ComponentType, 0, summary.State, true) + + s.printNewLine() + s.printFailure(indentation, summary.State, summary.Failure, fullTrace) + + s.endBlock() +} + +func (s *consoleStenographer) AnnounceCapturedOutput(output string) { + if output == "" { + return + } + + s.startBlock() + s.println(0, output) + s.midBlock() +} + +func (s *consoleStenographer) AnnounceSuccesfulSpec(spec *types.SpecSummary) { + s.print(0, s.colorize(greenColor, s.denoter)) + s.stream() +} + +func (s *consoleStenographer) AnnounceSuccesfulSlowSpec(spec *types.SpecSummary, succinct bool) { + s.printBlockWithMessage( + s.colorize(greenColor, "%s [SLOW TEST:%.3f seconds]", s.denoter, spec.RunTime.Seconds()), + "", + spec, + succinct, + ) +} + +func (s *consoleStenographer) AnnounceSuccesfulMeasurement(spec *types.SpecSummary, succinct bool) { + s.printBlockWithMessage( + s.colorize(greenColor, "%s [MEASUREMENT]", s.denoter), + s.measurementReport(spec, succinct), + spec, + succinct, + ) +} + +func (s *consoleStenographer) AnnouncePendingSpec(spec *types.SpecSummary, noisy bool) { + if noisy { + s.printBlockWithMessage( + s.colorize(yellowColor, "P [PENDING]"), + "", + spec, + false, + ) + } else { + s.print(0, s.colorize(yellowColor, "P")) + s.stream() + } +} + +func (s *consoleStenographer) AnnounceSkippedSpec(spec *types.SpecSummary, succinct bool, fullTrace bool) { + // Skips at runtime will have a non-empty spec.Failure. All others should be succinct. + if succinct || spec.Failure == (types.SpecFailure{}) { + s.print(0, s.colorize(cyanColor, "S")) + s.stream() + } else { + s.startBlock() + s.println(0, s.colorize(cyanColor+boldStyle, "S [SKIPPING]%s [%.3f seconds]", s.failureContext(spec.Failure.ComponentType), spec.RunTime.Seconds())) + + indentation := s.printCodeLocationBlock(spec.ComponentTexts, spec.ComponentCodeLocations, spec.Failure.ComponentType, spec.Failure.ComponentIndex, spec.State, succinct) + + s.printNewLine() + s.printSkip(indentation, spec.Failure) + s.endBlock() + } +} + +func (s *consoleStenographer) AnnounceSpecTimedOut(spec *types.SpecSummary, succinct bool, fullTrace bool) { + s.printSpecFailure(fmt.Sprintf("%s... Timeout", s.denoter), spec, succinct, fullTrace) +} + +func (s *consoleStenographer) AnnounceSpecPanicked(spec *types.SpecSummary, succinct bool, fullTrace bool) { + s.printSpecFailure(fmt.Sprintf("%s! Panic", s.denoter), spec, succinct, fullTrace) +} + +func (s *consoleStenographer) AnnounceSpecFailed(spec *types.SpecSummary, succinct bool, fullTrace bool) { + s.printSpecFailure(fmt.Sprintf("%s Failure", s.denoter), spec, succinct, fullTrace) +} + +func (s *consoleStenographer) SummarizeFailures(summaries []*types.SpecSummary) { + failingSpecs := []*types.SpecSummary{} + + for _, summary := range summaries { + if summary.HasFailureState() { + failingSpecs = append(failingSpecs, summary) + } + } + + if len(failingSpecs) == 0 { + return + } + + s.printNewLine() + s.printNewLine() + plural := "s" + if len(failingSpecs) == 1 { + plural = "" + } + s.println(0, s.colorize(redColor+boldStyle, "Summarizing %d Failure%s:", len(failingSpecs), plural)) + for _, summary := range failingSpecs { + s.printNewLine() + if summary.HasFailureState() { + if summary.TimedOut() { + s.print(0, s.colorize(redColor+boldStyle, "[Timeout...] ")) + } else if summary.Panicked() { + s.print(0, s.colorize(redColor+boldStyle, "[Panic!] ")) + } else if summary.Failed() { + s.print(0, s.colorize(redColor+boldStyle, "[Fail] ")) + } + s.printSpecContext(summary.ComponentTexts, summary.ComponentCodeLocations, summary.Failure.ComponentType, summary.Failure.ComponentIndex, summary.State, true) + s.printNewLine() + s.println(0, s.colorize(lightGrayColor, summary.Failure.Location.String())) + } + } +} + +func (s *consoleStenographer) startBlock() { + if s.cursorState == cursorStateStreaming { + s.printNewLine() + s.printDelimiter() + } else if s.cursorState == cursorStateMidBlock { + s.printNewLine() + } +} + +func (s *consoleStenographer) midBlock() { + s.cursorState = cursorStateMidBlock +} + +func (s *consoleStenographer) endBlock() { + s.printDelimiter() + s.cursorState = cursorStateEndBlock +} + +func (s *consoleStenographer) stream() { + s.cursorState = cursorStateStreaming +} + +func (s *consoleStenographer) printBlockWithMessage(header string, message string, spec *types.SpecSummary, succinct bool) { + s.startBlock() + s.println(0, header) + + indentation := s.printCodeLocationBlock(spec.ComponentTexts, spec.ComponentCodeLocations, types.SpecComponentTypeInvalid, 0, spec.State, succinct) + + if message != "" { + s.printNewLine() + s.println(indentation, message) + } + + s.endBlock() +} + +func (s *consoleStenographer) printSpecFailure(message string, spec *types.SpecSummary, succinct bool, fullTrace bool) { + s.startBlock() + s.println(0, s.colorize(redColor+boldStyle, "%s%s [%.3f seconds]", message, s.failureContext(spec.Failure.ComponentType), spec.RunTime.Seconds())) + + indentation := s.printCodeLocationBlock(spec.ComponentTexts, spec.ComponentCodeLocations, spec.Failure.ComponentType, spec.Failure.ComponentIndex, spec.State, succinct) + + s.printNewLine() + s.printFailure(indentation, spec.State, spec.Failure, fullTrace) + s.endBlock() +} + +func (s *consoleStenographer) failureContext(failedComponentType types.SpecComponentType) string { + switch failedComponentType { + case types.SpecComponentTypeBeforeSuite: + return " in Suite Setup (BeforeSuite)" + case types.SpecComponentTypeAfterSuite: + return " in Suite Teardown (AfterSuite)" + case types.SpecComponentTypeBeforeEach: + return " in Spec Setup (BeforeEach)" + case types.SpecComponentTypeJustBeforeEach: + return " in Spec Setup (JustBeforeEach)" + case types.SpecComponentTypeAfterEach: + return " in Spec Teardown (AfterEach)" + } + + return "" +} + +func (s *consoleStenographer) printSkip(indentation int, spec types.SpecFailure) { + s.println(indentation, s.colorize(cyanColor, spec.Message)) + s.printNewLine() + s.println(indentation, spec.Location.String()) +} + +func (s *consoleStenographer) printFailure(indentation int, state types.SpecState, failure types.SpecFailure, fullTrace bool) { + if state == types.SpecStatePanicked { + s.println(indentation, s.colorize(redColor+boldStyle, failure.Message)) + s.println(indentation, s.colorize(redColor, failure.ForwardedPanic)) + s.println(indentation, failure.Location.String()) + s.printNewLine() + s.println(indentation, s.colorize(redColor, "Full Stack Trace")) + s.println(indentation, failure.Location.FullStackTrace) + } else { + s.println(indentation, s.colorize(redColor, failure.Message)) + s.printNewLine() + s.println(indentation, failure.Location.String()) + if fullTrace { + s.printNewLine() + s.println(indentation, s.colorize(redColor, "Full Stack Trace")) + s.println(indentation, failure.Location.FullStackTrace) + } + } +} + +func (s *consoleStenographer) printSpecContext(componentTexts []string, componentCodeLocations []types.CodeLocation, failedComponentType types.SpecComponentType, failedComponentIndex int, state types.SpecState, succinct bool) int { + startIndex := 1 + indentation := 0 + + if len(componentTexts) == 1 { + startIndex = 0 + } + + for i := startIndex; i < len(componentTexts); i++ { + if (state.IsFailure() || state == types.SpecStateSkipped) && i == failedComponentIndex { + color := redColor + if state == types.SpecStateSkipped { + color = cyanColor + } + blockType := "" + switch failedComponentType { + case types.SpecComponentTypeBeforeSuite: + blockType = "BeforeSuite" + case types.SpecComponentTypeAfterSuite: + blockType = "AfterSuite" + case types.SpecComponentTypeBeforeEach: + blockType = "BeforeEach" + case types.SpecComponentTypeJustBeforeEach: + blockType = "JustBeforeEach" + case types.SpecComponentTypeAfterEach: + blockType = "AfterEach" + case types.SpecComponentTypeIt: + blockType = "It" + case types.SpecComponentTypeMeasure: + blockType = "Measurement" + } + if succinct { + s.print(0, s.colorize(color+boldStyle, "[%s] %s ", blockType, componentTexts[i])) + } else { + s.println(indentation, s.colorize(color+boldStyle, "%s [%s]", componentTexts[i], blockType)) + s.println(indentation, s.colorize(grayColor, "%s", componentCodeLocations[i])) + } + } else { + if succinct { + s.print(0, s.colorize(alternatingColors[i%2], "%s ", componentTexts[i])) + } else { + s.println(indentation, componentTexts[i]) + s.println(indentation, s.colorize(grayColor, "%s", componentCodeLocations[i])) + } + } + indentation++ + } + + return indentation +} + +func (s *consoleStenographer) printCodeLocationBlock(componentTexts []string, componentCodeLocations []types.CodeLocation, failedComponentType types.SpecComponentType, failedComponentIndex int, state types.SpecState, succinct bool) int { + indentation := s.printSpecContext(componentTexts, componentCodeLocations, failedComponentType, failedComponentIndex, state, succinct) + + if succinct { + if len(componentTexts) > 0 { + s.printNewLine() + s.print(0, s.colorize(lightGrayColor, "%s", componentCodeLocations[len(componentCodeLocations)-1])) + } + s.printNewLine() + indentation = 1 + } else { + indentation-- + } + + return indentation +} + +func (s *consoleStenographer) orderedMeasurementKeys(measurements map[string]*types.SpecMeasurement) []string { + orderedKeys := make([]string, len(measurements)) + for key, measurement := range measurements { + orderedKeys[measurement.Order] = key + } + return orderedKeys +} + +func (s *consoleStenographer) measurementReport(spec *types.SpecSummary, succinct bool) string { + if len(spec.Measurements) == 0 { + return "Found no measurements" + } + + message := []string{} + orderedKeys := s.orderedMeasurementKeys(spec.Measurements) + + if succinct { + message = append(message, fmt.Sprintf("%s samples:", s.colorize(boldStyle, "%d", spec.NumberOfSamples))) + for _, key := range orderedKeys { + measurement := spec.Measurements[key] + message = append(message, fmt.Sprintf(" %s - %s: %s%s, %s: %s%s ± %s%s, %s: %s%s", + s.colorize(boldStyle, "%s", measurement.Name), + measurement.SmallestLabel, + s.colorize(greenColor, measurement.PrecisionFmt(), measurement.Smallest), + measurement.Units, + measurement.AverageLabel, + s.colorize(cyanColor, measurement.PrecisionFmt(), measurement.Average), + measurement.Units, + s.colorize(cyanColor, measurement.PrecisionFmt(), measurement.StdDeviation), + measurement.Units, + measurement.LargestLabel, + s.colorize(redColor, measurement.PrecisionFmt(), measurement.Largest), + measurement.Units, + )) + } + } else { + message = append(message, fmt.Sprintf("Ran %s samples:", s.colorize(boldStyle, "%d", spec.NumberOfSamples))) + for _, key := range orderedKeys { + measurement := spec.Measurements[key] + info := "" + if measurement.Info != nil { + message = append(message, fmt.Sprintf("%v", measurement.Info)) + } + + message = append(message, fmt.Sprintf("%s:\n%s %s: %s%s\n %s: %s%s\n %s: %s%s ± %s%s", + s.colorize(boldStyle, "%s", measurement.Name), + info, + measurement.SmallestLabel, + s.colorize(greenColor, measurement.PrecisionFmt(), measurement.Smallest), + measurement.Units, + measurement.LargestLabel, + s.colorize(redColor, measurement.PrecisionFmt(), measurement.Largest), + measurement.Units, + measurement.AverageLabel, + s.colorize(cyanColor, measurement.PrecisionFmt(), measurement.Average), + measurement.Units, + s.colorize(cyanColor, measurement.PrecisionFmt(), measurement.StdDeviation), + measurement.Units, + )) + } + } + + return strings.Join(message, "\n") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/LICENSE b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/LICENSE new file mode 100644 index 0000000000..91b5cef30e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Yasuhiro Matsumoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/README.md b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/README.md new file mode 100644 index 0000000000..e84226a735 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/README.md @@ -0,0 +1,43 @@ +# go-colorable + +Colorable writer for windows. + +For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) +This package is possible to handle escape sequence for ansi color on windows. + +## Too Bad! + +![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) + + +## So Good! + +![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) + +## Usage + +```go +logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) +logrus.SetOutput(colorable.NewColorableStdout()) + +logrus.Info("succeeded") +logrus.Warn("not correct") +logrus.Error("something error") +logrus.Fatal("panic") +``` + +You can compile above code on non-windows OSs. + +## Installation + +``` +$ go get github.com/mattn/go-colorable +``` + +# License + +MIT + +# Author + +Yasuhiro Matsumoto (a.k.a mattn) diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go new file mode 100644 index 0000000000..52d6653b34 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go @@ -0,0 +1,24 @@ +// +build !windows + +package colorable + +import ( + "io" + "os" +) + +func NewColorable(file *os.File) io.Writer { + if file == nil { + panic("nil passed instead of *os.File to NewColorable()") + } + + return file +} + +func NewColorableStdout() io.Writer { + return os.Stdout +} + +func NewColorableStderr() io.Writer { + return os.Stderr +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_windows.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_windows.go new file mode 100644 index 0000000000..1088009230 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_windows.go @@ -0,0 +1,783 @@ +package colorable + +import ( + "bytes" + "fmt" + "io" + "math" + "os" + "strconv" + "strings" + "syscall" + "unsafe" + + "github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty" +) + +const ( + foregroundBlue = 0x1 + foregroundGreen = 0x2 + foregroundRed = 0x4 + foregroundIntensity = 0x8 + foregroundMask = (foregroundRed | foregroundBlue | foregroundGreen | foregroundIntensity) + backgroundBlue = 0x10 + backgroundGreen = 0x20 + backgroundRed = 0x40 + backgroundIntensity = 0x80 + backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity) +) + +type wchar uint16 +type short int16 +type dword uint32 +type word uint16 + +type coord struct { + x short + y short +} + +type smallRect struct { + left short + top short + right short + bottom short +} + +type consoleScreenBufferInfo struct { + size coord + cursorPosition coord + attributes word + window smallRect + maximumWindowSize coord +} + +var ( + kernel32 = syscall.NewLazyDLL("kernel32.dll") + procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo") + procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute") + procSetConsoleCursorPosition = kernel32.NewProc("SetConsoleCursorPosition") + procFillConsoleOutputCharacter = kernel32.NewProc("FillConsoleOutputCharacterW") + procFillConsoleOutputAttribute = kernel32.NewProc("FillConsoleOutputAttribute") +) + +type Writer struct { + out io.Writer + handle syscall.Handle + lastbuf bytes.Buffer + oldattr word +} + +func NewColorable(file *os.File) io.Writer { + if file == nil { + panic("nil passed instead of *os.File to NewColorable()") + } + + if isatty.IsTerminal(file.Fd()) { + var csbi consoleScreenBufferInfo + handle := syscall.Handle(file.Fd()) + procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) + return &Writer{out: file, handle: handle, oldattr: csbi.attributes} + } else { + return file + } +} + +func NewColorableStdout() io.Writer { + return NewColorable(os.Stdout) +} + +func NewColorableStderr() io.Writer { + return NewColorable(os.Stderr) +} + +var color256 = map[int]int{ + 0: 0x000000, + 1: 0x800000, + 2: 0x008000, + 3: 0x808000, + 4: 0x000080, + 5: 0x800080, + 6: 0x008080, + 7: 0xc0c0c0, + 8: 0x808080, + 9: 0xff0000, + 10: 0x00ff00, + 11: 0xffff00, + 12: 0x0000ff, + 13: 0xff00ff, + 14: 0x00ffff, + 15: 0xffffff, + 16: 0x000000, + 17: 0x00005f, + 18: 0x000087, + 19: 0x0000af, + 20: 0x0000d7, + 21: 0x0000ff, + 22: 0x005f00, + 23: 0x005f5f, + 24: 0x005f87, + 25: 0x005faf, + 26: 0x005fd7, + 27: 0x005fff, + 28: 0x008700, + 29: 0x00875f, + 30: 0x008787, + 31: 0x0087af, + 32: 0x0087d7, + 33: 0x0087ff, + 34: 0x00af00, + 35: 0x00af5f, + 36: 0x00af87, + 37: 0x00afaf, + 38: 0x00afd7, + 39: 0x00afff, + 40: 0x00d700, + 41: 0x00d75f, + 42: 0x00d787, + 43: 0x00d7af, + 44: 0x00d7d7, + 45: 0x00d7ff, + 46: 0x00ff00, + 47: 0x00ff5f, + 48: 0x00ff87, + 49: 0x00ffaf, + 50: 0x00ffd7, + 51: 0x00ffff, + 52: 0x5f0000, + 53: 0x5f005f, + 54: 0x5f0087, + 55: 0x5f00af, + 56: 0x5f00d7, + 57: 0x5f00ff, + 58: 0x5f5f00, + 59: 0x5f5f5f, + 60: 0x5f5f87, + 61: 0x5f5faf, + 62: 0x5f5fd7, + 63: 0x5f5fff, + 64: 0x5f8700, + 65: 0x5f875f, + 66: 0x5f8787, + 67: 0x5f87af, + 68: 0x5f87d7, + 69: 0x5f87ff, + 70: 0x5faf00, + 71: 0x5faf5f, + 72: 0x5faf87, + 73: 0x5fafaf, + 74: 0x5fafd7, + 75: 0x5fafff, + 76: 0x5fd700, + 77: 0x5fd75f, + 78: 0x5fd787, + 79: 0x5fd7af, + 80: 0x5fd7d7, + 81: 0x5fd7ff, + 82: 0x5fff00, + 83: 0x5fff5f, + 84: 0x5fff87, + 85: 0x5fffaf, + 86: 0x5fffd7, + 87: 0x5fffff, + 88: 0x870000, + 89: 0x87005f, + 90: 0x870087, + 91: 0x8700af, + 92: 0x8700d7, + 93: 0x8700ff, + 94: 0x875f00, + 95: 0x875f5f, + 96: 0x875f87, + 97: 0x875faf, + 98: 0x875fd7, + 99: 0x875fff, + 100: 0x878700, + 101: 0x87875f, + 102: 0x878787, + 103: 0x8787af, + 104: 0x8787d7, + 105: 0x8787ff, + 106: 0x87af00, + 107: 0x87af5f, + 108: 0x87af87, + 109: 0x87afaf, + 110: 0x87afd7, + 111: 0x87afff, + 112: 0x87d700, + 113: 0x87d75f, + 114: 0x87d787, + 115: 0x87d7af, + 116: 0x87d7d7, + 117: 0x87d7ff, + 118: 0x87ff00, + 119: 0x87ff5f, + 120: 0x87ff87, + 121: 0x87ffaf, + 122: 0x87ffd7, + 123: 0x87ffff, + 124: 0xaf0000, + 125: 0xaf005f, + 126: 0xaf0087, + 127: 0xaf00af, + 128: 0xaf00d7, + 129: 0xaf00ff, + 130: 0xaf5f00, + 131: 0xaf5f5f, + 132: 0xaf5f87, + 133: 0xaf5faf, + 134: 0xaf5fd7, + 135: 0xaf5fff, + 136: 0xaf8700, + 137: 0xaf875f, + 138: 0xaf8787, + 139: 0xaf87af, + 140: 0xaf87d7, + 141: 0xaf87ff, + 142: 0xafaf00, + 143: 0xafaf5f, + 144: 0xafaf87, + 145: 0xafafaf, + 146: 0xafafd7, + 147: 0xafafff, + 148: 0xafd700, + 149: 0xafd75f, + 150: 0xafd787, + 151: 0xafd7af, + 152: 0xafd7d7, + 153: 0xafd7ff, + 154: 0xafff00, + 155: 0xafff5f, + 156: 0xafff87, + 157: 0xafffaf, + 158: 0xafffd7, + 159: 0xafffff, + 160: 0xd70000, + 161: 0xd7005f, + 162: 0xd70087, + 163: 0xd700af, + 164: 0xd700d7, + 165: 0xd700ff, + 166: 0xd75f00, + 167: 0xd75f5f, + 168: 0xd75f87, + 169: 0xd75faf, + 170: 0xd75fd7, + 171: 0xd75fff, + 172: 0xd78700, + 173: 0xd7875f, + 174: 0xd78787, + 175: 0xd787af, + 176: 0xd787d7, + 177: 0xd787ff, + 178: 0xd7af00, + 179: 0xd7af5f, + 180: 0xd7af87, + 181: 0xd7afaf, + 182: 0xd7afd7, + 183: 0xd7afff, + 184: 0xd7d700, + 185: 0xd7d75f, + 186: 0xd7d787, + 187: 0xd7d7af, + 188: 0xd7d7d7, + 189: 0xd7d7ff, + 190: 0xd7ff00, + 191: 0xd7ff5f, + 192: 0xd7ff87, + 193: 0xd7ffaf, + 194: 0xd7ffd7, + 195: 0xd7ffff, + 196: 0xff0000, + 197: 0xff005f, + 198: 0xff0087, + 199: 0xff00af, + 200: 0xff00d7, + 201: 0xff00ff, + 202: 0xff5f00, + 203: 0xff5f5f, + 204: 0xff5f87, + 205: 0xff5faf, + 206: 0xff5fd7, + 207: 0xff5fff, + 208: 0xff8700, + 209: 0xff875f, + 210: 0xff8787, + 211: 0xff87af, + 212: 0xff87d7, + 213: 0xff87ff, + 214: 0xffaf00, + 215: 0xffaf5f, + 216: 0xffaf87, + 217: 0xffafaf, + 218: 0xffafd7, + 219: 0xffafff, + 220: 0xffd700, + 221: 0xffd75f, + 222: 0xffd787, + 223: 0xffd7af, + 224: 0xffd7d7, + 225: 0xffd7ff, + 226: 0xffff00, + 227: 0xffff5f, + 228: 0xffff87, + 229: 0xffffaf, + 230: 0xffffd7, + 231: 0xffffff, + 232: 0x080808, + 233: 0x121212, + 234: 0x1c1c1c, + 235: 0x262626, + 236: 0x303030, + 237: 0x3a3a3a, + 238: 0x444444, + 239: 0x4e4e4e, + 240: 0x585858, + 241: 0x626262, + 242: 0x6c6c6c, + 243: 0x767676, + 244: 0x808080, + 245: 0x8a8a8a, + 246: 0x949494, + 247: 0x9e9e9e, + 248: 0xa8a8a8, + 249: 0xb2b2b2, + 250: 0xbcbcbc, + 251: 0xc6c6c6, + 252: 0xd0d0d0, + 253: 0xdadada, + 254: 0xe4e4e4, + 255: 0xeeeeee, +} + +func (w *Writer) Write(data []byte) (n int, err error) { + var csbi consoleScreenBufferInfo + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + + er := bytes.NewBuffer(data) +loop: + for { + r1, _, err := procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + if r1 == 0 { + break loop + } + + c1, _, err := er.ReadRune() + if err != nil { + break loop + } + if c1 != 0x1b { + fmt.Fprint(w.out, string(c1)) + continue + } + c2, _, err := er.ReadRune() + if err != nil { + w.lastbuf.WriteRune(c1) + break loop + } + if c2 != 0x5b { + w.lastbuf.WriteRune(c1) + w.lastbuf.WriteRune(c2) + continue + } + + var buf bytes.Buffer + var m rune + for { + c, _, err := er.ReadRune() + if err != nil { + w.lastbuf.WriteRune(c1) + w.lastbuf.WriteRune(c2) + w.lastbuf.Write(buf.Bytes()) + break loop + } + if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { + m = c + break + } + buf.Write([]byte(string(c))) + } + + var csbi consoleScreenBufferInfo + switch m { + case 'A': + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.y -= short(n) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) + case 'B': + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.y += short(n) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) + case 'C': + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.x -= short(n) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) + case 'D': + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } + if n, err = strconv.Atoi(buf.String()); err == nil { + var csbi consoleScreenBufferInfo + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.x += short(n) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) + } + case 'E': + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.x = 0 + csbi.cursorPosition.y += short(n) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) + case 'F': + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.x = 0 + csbi.cursorPosition.y -= short(n) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) + case 'G': + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.x = short(n) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) + case 'H': + token := strings.Split(buf.String(), ";") + if len(token) != 2 { + continue + } + n1, err := strconv.Atoi(token[0]) + if err != nil { + continue + } + n2, err := strconv.Atoi(token[1]) + if err != nil { + continue + } + csbi.cursorPosition.x = short(n2) + csbi.cursorPosition.x = short(n1) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) + case 'J': + n, err := strconv.Atoi(buf.String()) + if err != nil { + continue + } + var cursor coord + switch n { + case 0: + cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} + case 1: + cursor = coord{x: csbi.window.left, y: csbi.window.top} + case 2: + cursor = coord{x: csbi.window.left, y: csbi.window.top} + } + var count, written dword + count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x) + procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) + procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) + case 'K': + n, err := strconv.Atoi(buf.String()) + if err != nil { + continue + } + var cursor coord + switch n { + case 0: + cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} + case 1: + cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y} + case 2: + cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y} + } + var count, written dword + count = dword(csbi.size.x - csbi.cursorPosition.x) + procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) + procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) + case 'm': + attr := csbi.attributes + cs := buf.String() + if cs == "" { + procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(w.oldattr)) + continue + } + token := strings.Split(cs, ";") + for i := 0; i < len(token); i += 1 { + ns := token[i] + if n, err = strconv.Atoi(ns); err == nil { + switch { + case n == 0 || n == 100: + attr = w.oldattr + case 1 <= n && n <= 5: + attr |= foregroundIntensity + case n == 7: + attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) + case 22 == n || n == 25 || n == 25: + attr |= foregroundIntensity + case n == 27: + attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) + case 30 <= n && n <= 37: + attr = (attr & backgroundMask) + if (n-30)&1 != 0 { + attr |= foregroundRed + } + if (n-30)&2 != 0 { + attr |= foregroundGreen + } + if (n-30)&4 != 0 { + attr |= foregroundBlue + } + case n == 38: // set foreground color. + if i < len(token)-2 && (token[i+1] == "5" || token[i+1] == "05") { + if n256, err := strconv.Atoi(token[i+2]); err == nil { + if n256foreAttr == nil { + n256setup() + } + attr &= backgroundMask + attr |= n256foreAttr[n256] + i += 2 + } + } else { + attr = attr & (w.oldattr & backgroundMask) + } + case n == 39: // reset foreground color. + attr &= backgroundMask + attr |= w.oldattr & foregroundMask + case 40 <= n && n <= 47: + attr = (attr & foregroundMask) + if (n-40)&1 != 0 { + attr |= backgroundRed + } + if (n-40)&2 != 0 { + attr |= backgroundGreen + } + if (n-40)&4 != 0 { + attr |= backgroundBlue + } + case n == 48: // set background color. + if i < len(token)-2 && token[i+1] == "5" { + if n256, err := strconv.Atoi(token[i+2]); err == nil { + if n256backAttr == nil { + n256setup() + } + attr &= foregroundMask + attr |= n256backAttr[n256] + i += 2 + } + } else { + attr = attr & (w.oldattr & foregroundMask) + } + case n == 49: // reset foreground color. + attr &= foregroundMask + attr |= w.oldattr & backgroundMask + case 90 <= n && n <= 97: + attr = (attr & backgroundMask) + attr |= foregroundIntensity + if (n-90)&1 != 0 { + attr |= foregroundRed + } + if (n-90)&2 != 0 { + attr |= foregroundGreen + } + if (n-90)&4 != 0 { + attr |= foregroundBlue + } + case 100 <= n && n <= 107: + attr = (attr & foregroundMask) + attr |= backgroundIntensity + if (n-100)&1 != 0 { + attr |= backgroundRed + } + if (n-100)&2 != 0 { + attr |= backgroundGreen + } + if (n-100)&4 != 0 { + attr |= backgroundBlue + } + } + procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr)) + } + } + } + } + return len(data) - w.lastbuf.Len(), nil +} + +type consoleColor struct { + rgb int + red bool + green bool + blue bool + intensity bool +} + +func (c consoleColor) foregroundAttr() (attr word) { + if c.red { + attr |= foregroundRed + } + if c.green { + attr |= foregroundGreen + } + if c.blue { + attr |= foregroundBlue + } + if c.intensity { + attr |= foregroundIntensity + } + return +} + +func (c consoleColor) backgroundAttr() (attr word) { + if c.red { + attr |= backgroundRed + } + if c.green { + attr |= backgroundGreen + } + if c.blue { + attr |= backgroundBlue + } + if c.intensity { + attr |= backgroundIntensity + } + return +} + +var color16 = []consoleColor{ + consoleColor{0x000000, false, false, false, false}, + consoleColor{0x000080, false, false, true, false}, + consoleColor{0x008000, false, true, false, false}, + consoleColor{0x008080, false, true, true, false}, + consoleColor{0x800000, true, false, false, false}, + consoleColor{0x800080, true, false, true, false}, + consoleColor{0x808000, true, true, false, false}, + consoleColor{0xc0c0c0, true, true, true, false}, + consoleColor{0x808080, false, false, false, true}, + consoleColor{0x0000ff, false, false, true, true}, + consoleColor{0x00ff00, false, true, false, true}, + consoleColor{0x00ffff, false, true, true, true}, + consoleColor{0xff0000, true, false, false, true}, + consoleColor{0xff00ff, true, false, true, true}, + consoleColor{0xffff00, true, true, false, true}, + consoleColor{0xffffff, true, true, true, true}, +} + +type hsv struct { + h, s, v float32 +} + +func (a hsv) dist(b hsv) float32 { + dh := a.h - b.h + switch { + case dh > 0.5: + dh = 1 - dh + case dh < -0.5: + dh = -1 - dh + } + ds := a.s - b.s + dv := a.v - b.v + return float32(math.Sqrt(float64(dh*dh + ds*ds + dv*dv))) +} + +func toHSV(rgb int) hsv { + r, g, b := float32((rgb&0xFF0000)>>16)/256.0, + float32((rgb&0x00FF00)>>8)/256.0, + float32(rgb&0x0000FF)/256.0 + min, max := minmax3f(r, g, b) + h := max - min + if h > 0 { + if max == r { + h = (g - b) / h + if h < 0 { + h += 6 + } + } else if max == g { + h = 2 + (b-r)/h + } else { + h = 4 + (r-g)/h + } + } + h /= 6.0 + s := max - min + if max != 0 { + s /= max + } + v := max + return hsv{h: h, s: s, v: v} +} + +type hsvTable []hsv + +func toHSVTable(rgbTable []consoleColor) hsvTable { + t := make(hsvTable, len(rgbTable)) + for i, c := range rgbTable { + t[i] = toHSV(c.rgb) + } + return t +} + +func (t hsvTable) find(rgb int) consoleColor { + hsv := toHSV(rgb) + n := 7 + l := float32(5.0) + for i, p := range t { + d := hsv.dist(p) + if d < l { + l, n = d, i + } + } + return color16[n] +} + +func minmax3f(a, b, c float32) (min, max float32) { + if a < b { + if b < c { + return a, c + } else if a < c { + return a, b + } else { + return c, b + } + } else { + if a < c { + return b, c + } else if b < c { + return b, a + } else { + return c, a + } + } +} + +var n256foreAttr []word +var n256backAttr []word + +func n256setup() { + n256foreAttr = make([]word, 256) + n256backAttr = make([]word, 256) + t := toHSVTable(color16) + for i, rgb := range color256 { + c := t.find(rgb) + n256foreAttr[i] = c.foregroundAttr() + n256backAttr[i] = c.backgroundAttr() + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/noncolorable.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/noncolorable.go new file mode 100644 index 0000000000..fb976dbd8b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/noncolorable.go @@ -0,0 +1,57 @@ +package colorable + +import ( + "bytes" + "fmt" + "io" +) + +type NonColorable struct { + out io.Writer + lastbuf bytes.Buffer +} + +func NewNonColorable(w io.Writer) io.Writer { + return &NonColorable{out: w} +} + +func (w *NonColorable) Write(data []byte) (n int, err error) { + er := bytes.NewBuffer(data) +loop: + for { + c1, _, err := er.ReadRune() + if err != nil { + break loop + } + if c1 != 0x1b { + fmt.Fprint(w.out, string(c1)) + continue + } + c2, _, err := er.ReadRune() + if err != nil { + w.lastbuf.WriteRune(c1) + break loop + } + if c2 != 0x5b { + w.lastbuf.WriteRune(c1) + w.lastbuf.WriteRune(c2) + continue + } + + var buf bytes.Buffer + for { + c, _, err := er.ReadRune() + if err != nil { + w.lastbuf.WriteRune(c1) + w.lastbuf.WriteRune(c2) + w.lastbuf.Write(buf.Bytes()) + break loop + } + if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { + break + } + buf.Write([]byte(string(c))) + } + } + return len(data) - w.lastbuf.Len(), nil +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/LICENSE b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/LICENSE new file mode 100644 index 0000000000..65dc692b6b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/LICENSE @@ -0,0 +1,9 @@ +Copyright (c) Yasuhiro MATSUMOTO + +MIT License (Expat) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/README.md b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/README.md new file mode 100644 index 0000000000..74845de4a2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/README.md @@ -0,0 +1,37 @@ +# go-isatty + +isatty for golang + +## Usage + +```go +package main + +import ( + "fmt" + "github.com/mattn/go-isatty" + "os" +) + +func main() { + if isatty.IsTerminal(os.Stdout.Fd()) { + fmt.Println("Is Terminal") + } else { + fmt.Println("Is Not Terminal") + } +} +``` + +## Installation + +``` +$ go get github.com/mattn/go-isatty +``` + +# License + +MIT + +# Author + +Yasuhiro Matsumoto (a.k.a mattn) diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/doc.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/doc.go new file mode 100644 index 0000000000..17d4f90ebc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/doc.go @@ -0,0 +1,2 @@ +// Package isatty implements interface to isatty +package isatty diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go new file mode 100644 index 0000000000..83c588773c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go @@ -0,0 +1,9 @@ +// +build appengine + +package isatty + +// IsTerminal returns true if the file descriptor is terminal which +// is always false on on appengine classic which is a sandboxed PaaS. +func IsTerminal(fd uintptr) bool { + return false +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go new file mode 100644 index 0000000000..98ffe86a4b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go @@ -0,0 +1,18 @@ +// +build darwin freebsd openbsd netbsd +// +build !appengine + +package isatty + +import ( + "syscall" + "unsafe" +) + +const ioctlReadTermios = syscall.TIOCGETA + +// IsTerminal return true if the file descriptor is terminal. +func IsTerminal(fd uintptr) bool { + var termios syscall.Termios + _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) + return err == 0 +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go new file mode 100644 index 0000000000..9d24bac1db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go @@ -0,0 +1,18 @@ +// +build linux +// +build !appengine + +package isatty + +import ( + "syscall" + "unsafe" +) + +const ioctlReadTermios = syscall.TCGETS + +// IsTerminal return true if the file descriptor is terminal. +func IsTerminal(fd uintptr) bool { + var termios syscall.Termios + _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) + return err == 0 +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go new file mode 100644 index 0000000000..1f0c6bf53d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go @@ -0,0 +1,16 @@ +// +build solaris +// +build !appengine + +package isatty + +import ( + "golang.org/x/sys/unix" +) + +// IsTerminal returns true if the given file descriptor is a terminal. +// see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c +func IsTerminal(fd uintptr) bool { + var termio unix.Termio + err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) + return err == nil +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go new file mode 100644 index 0000000000..83c398b16d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go @@ -0,0 +1,19 @@ +// +build windows +// +build !appengine + +package isatty + +import ( + "syscall" + "unsafe" +) + +var kernel32 = syscall.NewLazyDLL("kernel32.dll") +var procGetConsoleMode = kernel32.NewProc("GetConsoleMode") + +// IsTerminal return true if the file descriptor is terminal. +func IsTerminal(fd uintptr) bool { + var st uint32 + r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) + return r != 0 && e == 0 +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/teamcity_reporter.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/teamcity_reporter.go new file mode 100644 index 0000000000..657dfe726e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/reporters/teamcity_reporter.go @@ -0,0 +1,92 @@ +/* + +TeamCity Reporter for Ginkgo + +Makes use of TeamCity's support for Service Messages +http://confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingTests +*/ + +package reporters + +import ( + "fmt" + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/types" + "io" + "strings" +) + +const ( + messageId = "##teamcity" +) + +type TeamCityReporter struct { + writer io.Writer + testSuiteName string +} + +func NewTeamCityReporter(writer io.Writer) *TeamCityReporter { + return &TeamCityReporter{ + writer: writer, + } +} + +func (reporter *TeamCityReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) { + reporter.testSuiteName = escape(summary.SuiteDescription) + fmt.Fprintf(reporter.writer, "%s[testSuiteStarted name='%s']", messageId, reporter.testSuiteName) +} + +func (reporter *TeamCityReporter) BeforeSuiteDidRun(setupSummary *types.SetupSummary) { + reporter.handleSetupSummary("BeforeSuite", setupSummary) +} + +func (reporter *TeamCityReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary) { + reporter.handleSetupSummary("AfterSuite", setupSummary) +} + +func (reporter *TeamCityReporter) handleSetupSummary(name string, setupSummary *types.SetupSummary) { + if setupSummary.State != types.SpecStatePassed { + testName := escape(name) + fmt.Fprintf(reporter.writer, "%s[testStarted name='%s']", messageId, testName) + message := escape(setupSummary.Failure.ComponentCodeLocation.String()) + details := escape(setupSummary.Failure.Message) + fmt.Fprintf(reporter.writer, "%s[testFailed name='%s' message='%s' details='%s']", messageId, testName, message, details) + durationInMilliseconds := setupSummary.RunTime.Seconds() * 1000 + fmt.Fprintf(reporter.writer, "%s[testFinished name='%s' duration='%v']", messageId, testName, durationInMilliseconds) + } +} + +func (reporter *TeamCityReporter) SpecWillRun(specSummary *types.SpecSummary) { + testName := escape(strings.Join(specSummary.ComponentTexts[1:], " ")) + fmt.Fprintf(reporter.writer, "%s[testStarted name='%s']", messageId, testName) +} + +func (reporter *TeamCityReporter) SpecDidComplete(specSummary *types.SpecSummary) { + testName := escape(strings.Join(specSummary.ComponentTexts[1:], " ")) + + if specSummary.State == types.SpecStateFailed || specSummary.State == types.SpecStateTimedOut || specSummary.State == types.SpecStatePanicked { + message := escape(specSummary.Failure.ComponentCodeLocation.String()) + details := escape(specSummary.Failure.Message) + fmt.Fprintf(reporter.writer, "%s[testFailed name='%s' message='%s' details='%s']", messageId, testName, message, details) + } + if specSummary.State == types.SpecStateSkipped || specSummary.State == types.SpecStatePending { + fmt.Fprintf(reporter.writer, "%s[testIgnored name='%s']", messageId, testName) + } + + durationInMilliseconds := specSummary.RunTime.Seconds() * 1000 + fmt.Fprintf(reporter.writer, "%s[testFinished name='%s' duration='%v']", messageId, testName, durationInMilliseconds) +} + +func (reporter *TeamCityReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) { + fmt.Fprintf(reporter.writer, "%s[testSuiteFinished name='%s']", messageId, reporter.testSuiteName) +} + +func escape(output string) string { + output = strings.Replace(output, "|", "||", -1) + output = strings.Replace(output, "'", "|'", -1) + output = strings.Replace(output, "\n", "|n", -1) + output = strings.Replace(output, "\r", "|r", -1) + output = strings.Replace(output, "[", "|[", -1) + output = strings.Replace(output, "]", "|]", -1) + return output +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/code_location.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/code_location.go new file mode 100644 index 0000000000..935a89e136 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/code_location.go @@ -0,0 +1,15 @@ +package types + +import ( + "fmt" +) + +type CodeLocation struct { + FileName string + LineNumber int + FullStackTrace string +} + +func (codeLocation CodeLocation) String() string { + return fmt.Sprintf("%s:%d", codeLocation.FileName, codeLocation.LineNumber) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/synchronization.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/synchronization.go new file mode 100644 index 0000000000..fdd6ed5bdf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/synchronization.go @@ -0,0 +1,30 @@ +package types + +import ( + "encoding/json" +) + +type RemoteBeforeSuiteState int + +const ( + RemoteBeforeSuiteStateInvalid RemoteBeforeSuiteState = iota + + RemoteBeforeSuiteStatePending + RemoteBeforeSuiteStatePassed + RemoteBeforeSuiteStateFailed + RemoteBeforeSuiteStateDisappeared +) + +type RemoteBeforeSuiteData struct { + Data []byte + State RemoteBeforeSuiteState +} + +func (r RemoteBeforeSuiteData) ToJSON() []byte { + data, _ := json.Marshal(r) + return data +} + +type RemoteAfterSuiteData struct { + CanRun bool +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/types.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/types.go new file mode 100644 index 0000000000..baf1bd1c47 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/ginkgo/types/types.go @@ -0,0 +1,173 @@ +package types + +import ( + "strconv" + "time" +) + +const GINKGO_FOCUS_EXIT_CODE = 197 + +/* +SuiteSummary represents the a summary of the test suite and is passed to both +Reporter.SpecSuiteWillBegin +Reporter.SpecSuiteDidEnd + +this is unfortunate as these two methods should receive different objects. When running in parallel +each node does not deterministically know how many specs it will end up running. + +Unfortunately making such a change would break backward compatibility. + +Until Ginkgo 2.0 comes out we will continue to reuse this struct but populate unkown fields +with -1. +*/ +type SuiteSummary struct { + SuiteDescription string + SuiteSucceeded bool + SuiteID string + + NumberOfSpecsBeforeParallelization int + NumberOfTotalSpecs int + NumberOfSpecsThatWillBeRun int + NumberOfPendingSpecs int + NumberOfSkippedSpecs int + NumberOfPassedSpecs int + NumberOfFailedSpecs int + // Flaked specs are those that failed initially, but then passed on a + // subsequent try. + NumberOfFlakedSpecs int + RunTime time.Duration +} + +type SpecSummary struct { + ComponentTexts []string + ComponentCodeLocations []CodeLocation + + State SpecState + RunTime time.Duration + Failure SpecFailure + IsMeasurement bool + NumberOfSamples int + Measurements map[string]*SpecMeasurement + + CapturedOutput string + SuiteID string +} + +func (s SpecSummary) HasFailureState() bool { + return s.State.IsFailure() +} + +func (s SpecSummary) TimedOut() bool { + return s.State == SpecStateTimedOut +} + +func (s SpecSummary) Panicked() bool { + return s.State == SpecStatePanicked +} + +func (s SpecSummary) Failed() bool { + return s.State == SpecStateFailed +} + +func (s SpecSummary) Passed() bool { + return s.State == SpecStatePassed +} + +func (s SpecSummary) Skipped() bool { + return s.State == SpecStateSkipped +} + +func (s SpecSummary) Pending() bool { + return s.State == SpecStatePending +} + +type SetupSummary struct { + ComponentType SpecComponentType + CodeLocation CodeLocation + + State SpecState + RunTime time.Duration + Failure SpecFailure + + CapturedOutput string + SuiteID string +} + +type SpecFailure struct { + Message string + Location CodeLocation + ForwardedPanic string + + ComponentIndex int + ComponentType SpecComponentType + ComponentCodeLocation CodeLocation +} + +type SpecMeasurement struct { + Name string + Info interface{} + Order int + + Results []float64 + + Smallest float64 + Largest float64 + Average float64 + StdDeviation float64 + + SmallestLabel string + LargestLabel string + AverageLabel string + Units string + Precision int +} + +func (s SpecMeasurement) PrecisionFmt() string { + if s.Precision == 0 { + return "%f" + } + + str := strconv.Itoa(s.Precision) + + return "%." + str + "f" +} + +type SpecState uint + +const ( + SpecStateInvalid SpecState = iota + + SpecStatePending + SpecStateSkipped + SpecStatePassed + SpecStateFailed + SpecStatePanicked + SpecStateTimedOut +) + +func (state SpecState) IsFailure() bool { + return state == SpecStateTimedOut || state == SpecStatePanicked || state == SpecStateFailed +} + +type SpecComponentType uint + +const ( + SpecComponentTypeInvalid SpecComponentType = iota + + SpecComponentTypeContainer + SpecComponentTypeBeforeSuite + SpecComponentTypeAfterSuite + SpecComponentTypeBeforeEach + SpecComponentTypeJustBeforeEach + SpecComponentTypeAfterEach + SpecComponentTypeIt + SpecComponentTypeMeasure +) + +type FlagType uint + +const ( + FlagTypeNone FlagType = iota + FlagTypeFocused + FlagTypePending +) diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/CHANGELOG.md new file mode 100644 index 0000000000..a3e8ee4447 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -0,0 +1,74 @@ +## HEAD + +## 1.2.0 + +Improvements: + +- Added `BeSent` which attempts to send a value down a channel and fails if the attempt blocks. Can be paired with `Eventually` to safely send a value down a channel with a timeout. +- `Ω`, `Expect`, `Eventually`, and `Consistently` now immediately `panic` if there is no registered fail handler. This is always a mistake that can hide failing tests. +- `Receive()` no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so Ω(c).Should(Receive()) always fails and Ω(c).ShoudlNot(Receive()) always passes with a closed channel. +- Added `HavePrefix` and `HaveSuffix` matchers. +- `ghttp` can now handle concurrent requests. +- Added `Succeed` which allows one to write `Ω(MyFunction()).Should(Succeed())`. +- Improved `ghttp`'s behavior around failing assertions and panics: + - If a registered handler makes a failing assertion `ghttp` will return `500`. + - If a registered handler panics, `ghttp` will return `500` *and* fail the test. This is new behavior that may cause existing code to break. This code is almost certainly incorrect and creating a false positive. +- `ghttp` servers can take an `io.Writer`. `ghttp` will write a line to the writer when each request arrives. +- Added `WithTransform` matcher to allow munging input data before feeding into the relevant matcher +- Added boolean `And`, `Or`, and `Not` matchers to allow creating composite matchers +- Added `gbytes.TimeoutCloser`, `gbytes.TimeoutReader`, and `gbytes.TimeoutWriter` - these are convenience wrappers that timeout if the underlying Closer/Reader/Writer does not return within the alloted time. +- Added `gbytes.BufferReader` - this constructs a `gbytes.Buffer` that asynchronously reads the passed-in `io.Reader` into its buffer. + +Bug Fixes: +- gexec: `session.Wait` now uses `EventuallyWithOffset` to get the right line number in the failure. +- `ContainElement` no longer bails if a passed-in matcher errors. + +## 1.0 (8/2/2014) + +No changes. Dropping "beta" from the version number. + +## 1.0.0-beta (7/8/2014) +Breaking Changes: + +- Changed OmegaMatcher interface. Instead of having `Match` return failure messages, two new methods `FailureMessage` and `NegatedFailureMessage` are called instead. +- Moved and renamed OmegaFailHandler to types.GomegaFailHandler and OmegaMatcher to types.GomegaMatcher. Any references to OmegaMatcher in any custom matchers will need to be changed to point to types.GomegaMatcher + +New Test-Support Features: + +- `ghttp`: supports testing http clients + - Provides a flexible fake http server + - Provides a collection of chainable http handlers that perform assertions. +- `gbytes`: supports making ordered assertions against streams of data + - Provides a `gbytes.Buffer` + - Provides a `Say` matcher to perform ordered assertions against output data +- `gexec`: supports testing external processes + - Provides support for building Go binaries + - Wraps and starts `exec.Cmd` commands + - Makes it easy to assert against stdout and stderr + - Makes it easy to send signals and wait for processes to exit + - Provides an `Exit` matcher to assert against exit code. + +DSL Changes: + +- `Eventually` and `Consistently` can accept `time.Duration` interval and polling inputs. +- The default timeouts for `Eventually` and `Consistently` are now configurable. + +New Matchers: + +- `ConsistOf`: order-independent assertion against the elements of an array/slice or keys of a map. +- `BeTemporally`: like `BeNumerically` but for `time.Time` +- `HaveKeyWithValue`: asserts a map has a given key with the given value. + +Updated Matchers: + +- `Receive` matcher can take a matcher as an argument and passes only if the channel under test receives an objet that satisfies the passed-in matcher. +- Matchers that implement `MatchMayChangeInTheFuture(actual interface{}) bool` can inform `Eventually` and/or `Consistently` when a match has no chance of changing status in the future. For example, `Receive` returns `false` when a channel is closed. + +Misc: + +- Start using semantic versioning +- Start maintaining changelog + +Major refactor: + +- Pull out Gomega's internal to `internal` diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/CONTRIBUTING.md b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/CONTRIBUTING.md new file mode 100644 index 0000000000..73d4020e6b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing to Gomega + +Your contributions to Gomega are essential for its long-term maintenance and improvement. To make a contribution: + +- Please **open an issue first** - describe what problem you are trying to solve and give the community a forum for input and feedback ahead of investing time in writing code! +- Ensure adequate test coverage: + - Make sure to add appropriate unit tests + - Please run all tests locally (`ginkgo -r -p`) and make sure they go green before submitting the PR +- Update the documentation. In addition to standard `godoc` comments Gomega has extensive documentation on the `gh-pages` branch. If relevant, please submit a docs PR to that branch alongside your code PR. + +Thanks for supporting Gomega! \ No newline at end of file diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/LICENSE b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/LICENSE new file mode 100644 index 0000000000..9415ee72c1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013-2014 Onsi Fakhouri + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/README.md b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/README.md new file mode 100644 index 0000000000..159be35907 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/README.md @@ -0,0 +1,21 @@ +![Gomega: Ginkgo's Preferred Matcher Library](http://onsi.github.io/gomega/images/gomega.png) + +[![Build Status](https://travis-ci.org/onsi/gomega.svg)](https://travis-ci.org/onsi/gomega) + +Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers). + +If you have a question, comment, bug report, feature request, etc. please open a GitHub issue. + +## [Ginkgo](http://github.com/onsi/ginkgo): a BDD Testing Framework for Golang + +Learn more about Ginkgo [here](http://onsi.github.io/ginkgo/) + +## Community Matchers + +A collection of community matchers is available on the [wiki](https://github.com/onsi/gomega/wiki). + +## License + +Gomega is MIT-Licensed + +The `ConsistOf` matcher uses [goraph](https://github.com/amitkgupta/goraph) which is embedded in the source to simplify distribution. goraph has an MIT license. diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/format/format.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/format/format.go new file mode 100644 index 0000000000..e206ee59a4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/format/format.go @@ -0,0 +1,379 @@ +/* +Gomega's format package pretty-prints objects. It explores input objects recursively and generates formatted, indented output with type information. +*/ +package format + +import ( + "fmt" + "reflect" + "strconv" + "strings" + "time" +) + +// Use MaxDepth to set the maximum recursion depth when printing deeply nested objects +var MaxDepth = uint(10) + +/* +By default, all objects (even those that implement fmt.Stringer and fmt.GoStringer) are recursively inspected to generate output. + +Set UseStringerRepresentation = true to use GoString (for fmt.GoStringers) or String (for fmt.Stringer) instead. + +Note that GoString and String don't always have all the information you need to understand why a test failed! +*/ +var UseStringerRepresentation = false + +/* +Print the content of context objects. By default it will be suppressed. + +Set PrintContextObjects = true to enable printing of the context internals. +*/ +var PrintContextObjects = false + +// Ctx interface defined here to keep backwards compatability with go < 1.7 +// It matches the context.Context interface +type Ctx interface { + Deadline() (deadline time.Time, ok bool) + Done() <-chan struct{} + Err() error + Value(key interface{}) interface{} +} + +var contextType = reflect.TypeOf((*Ctx)(nil)).Elem() +var timeType = reflect.TypeOf(time.Time{}) + +//The default indentation string emitted by the format package +var Indent = " " + +var longFormThreshold = 20 + +/* +Generates a formatted matcher success/failure message of the form: + + Expected + + + + +If expected is omited, then the message looks like: + + Expected + + +*/ +func Message(actual interface{}, message string, expected ...interface{}) string { + if len(expected) == 0 { + return fmt.Sprintf("Expected\n%s\n%s", Object(actual, 1), message) + } + return fmt.Sprintf("Expected\n%s\n%s\n%s", Object(actual, 1), message, Object(expected[0], 1)) +} + +/* + +Generates a nicely formatted matcher success / failure message + +Much like Message(...), but it attempts to pretty print diffs in strings + +Expected + : "...aaaaabaaaaa..." +to equal | + : "...aaaaazaaaaa..." + +*/ + +func MessageWithDiff(actual, message, expected string) string { + if len(actual) >= truncateThreshold && len(expected) >= truncateThreshold { + diffPoint := findFirstMismatch(actual, expected) + formattedActual := truncateAndFormat(actual, diffPoint) + formattedExpected := truncateAndFormat(expected, diffPoint) + + spacesBeforeFormattedMismatch := findFirstMismatch(formattedActual, formattedExpected) + + tabLength := 4 + spaceFromMessageToActual := tabLength + len(": ") - len(message) + padding := strings.Repeat(" ", spaceFromMessageToActual+spacesBeforeFormattedMismatch) + "|" + return Message(formattedActual, message+padding, formattedExpected) + } + return Message(actual, message, expected) +} + +func truncateAndFormat(str string, index int) string { + leftPadding := `...` + rightPadding := `...` + + start := index - charactersAroundMismatchToInclude + if start < 0 { + start = 0 + leftPadding = "" + } + + // slice index must include the mis-matched character + lengthOfMismatchedCharacter := 1 + end := index + charactersAroundMismatchToInclude + lengthOfMismatchedCharacter + if end > len(str) { + end = len(str) + rightPadding = "" + + } + return fmt.Sprintf("\"%s\"", leftPadding+str[start:end]+rightPadding) +} + +func findFirstMismatch(a, b string) int { + aSlice := strings.Split(a, "") + bSlice := strings.Split(b, "") + + for index, str := range aSlice { + if index > len(b) - 1 { + return index + } + if str != bSlice[index] { + return index + } + } + + if len(b) > len(a) { + return len(a) + 1 + } + + return 0 +} + +const ( + truncateThreshold = 50 + charactersAroundMismatchToInclude = 5 +) + +/* +Pretty prints the passed in object at the passed in indentation level. + +Object recurses into deeply nested objects emitting pretty-printed representations of their components. + +Modify format.MaxDepth to control how deep the recursion is allowed to go +Set format.UseStringerRepresentation to true to return object.GoString() or object.String() when available instead of +recursing into the object. + +Set PrintContextObjects to true to print the content of objects implementing context.Context +*/ +func Object(object interface{}, indentation uint) string { + indent := strings.Repeat(Indent, int(indentation)) + value := reflect.ValueOf(object) + return fmt.Sprintf("%s<%s>: %s", indent, formatType(object), formatValue(value, indentation)) +} + +/* +IndentString takes a string and indents each line by the specified amount. +*/ +func IndentString(s string, indentation uint) string { + components := strings.Split(s, "\n") + result := "" + indent := strings.Repeat(Indent, int(indentation)) + for i, component := range components { + result += indent + component + if i < len(components)-1 { + result += "\n" + } + } + + return result +} + +func formatType(object interface{}) string { + t := reflect.TypeOf(object) + if t == nil { + return "nil" + } + switch t.Kind() { + case reflect.Chan: + v := reflect.ValueOf(object) + return fmt.Sprintf("%T | len:%d, cap:%d", object, v.Len(), v.Cap()) + case reflect.Ptr: + return fmt.Sprintf("%T | %p", object, object) + case reflect.Slice: + v := reflect.ValueOf(object) + return fmt.Sprintf("%T | len:%d, cap:%d", object, v.Len(), v.Cap()) + case reflect.Map: + v := reflect.ValueOf(object) + return fmt.Sprintf("%T | len:%d", object, v.Len()) + default: + return fmt.Sprintf("%T", object) + } +} + +func formatValue(value reflect.Value, indentation uint) string { + if indentation > MaxDepth { + return "..." + } + + if isNilValue(value) { + return "nil" + } + + if UseStringerRepresentation { + if value.CanInterface() { + obj := value.Interface() + switch x := obj.(type) { + case fmt.GoStringer: + return x.GoString() + case fmt.Stringer: + return x.String() + } + } + } + + if !PrintContextObjects { + if value.Type().Implements(contextType) && indentation > 1 { + return "" + } + } + + switch value.Kind() { + case reflect.Bool: + return fmt.Sprintf("%v", value.Bool()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return fmt.Sprintf("%v", value.Int()) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return fmt.Sprintf("%v", value.Uint()) + case reflect.Uintptr: + return fmt.Sprintf("0x%x", value.Uint()) + case reflect.Float32, reflect.Float64: + return fmt.Sprintf("%v", value.Float()) + case reflect.Complex64, reflect.Complex128: + return fmt.Sprintf("%v", value.Complex()) + case reflect.Chan: + return fmt.Sprintf("0x%x", value.Pointer()) + case reflect.Func: + return fmt.Sprintf("0x%x", value.Pointer()) + case reflect.Ptr: + return formatValue(value.Elem(), indentation) + case reflect.Slice: + return formatSlice(value, indentation) + case reflect.String: + return formatString(value.String(), indentation) + case reflect.Array: + return formatSlice(value, indentation) + case reflect.Map: + return formatMap(value, indentation) + case reflect.Struct: + if value.Type() == timeType && value.CanInterface() { + t, _ := value.Interface().(time.Time) + return t.Format(time.RFC3339Nano) + } + return formatStruct(value, indentation) + case reflect.Interface: + return formatValue(value.Elem(), indentation) + default: + if value.CanInterface() { + return fmt.Sprintf("%#v", value.Interface()) + } + return fmt.Sprintf("%#v", value) + } +} + +func formatString(object interface{}, indentation uint) string { + if indentation == 1 { + s := fmt.Sprintf("%s", object) + components := strings.Split(s, "\n") + result := "" + for i, component := range components { + if i == 0 { + result += component + } else { + result += Indent + component + } + if i < len(components)-1 { + result += "\n" + } + } + + return fmt.Sprintf("%s", result) + } else { + return fmt.Sprintf("%q", object) + } +} + +func formatSlice(v reflect.Value, indentation uint) string { + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 && isPrintableString(string(v.Bytes())) { + return formatString(v.Bytes(), indentation) + } + + l := v.Len() + result := make([]string, l) + longest := 0 + for i := 0; i < l; i++ { + result[i] = formatValue(v.Index(i), indentation+1) + if len(result[i]) > longest { + longest = len(result[i]) + } + } + + if longest > longFormThreshold { + indenter := strings.Repeat(Indent, int(indentation)) + return fmt.Sprintf("[\n%s%s,\n%s]", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) + } + return fmt.Sprintf("[%s]", strings.Join(result, ", ")) +} + +func formatMap(v reflect.Value, indentation uint) string { + l := v.Len() + result := make([]string, l) + + longest := 0 + for i, key := range v.MapKeys() { + value := v.MapIndex(key) + result[i] = fmt.Sprintf("%s: %s", formatValue(key, indentation+1), formatValue(value, indentation+1)) + if len(result[i]) > longest { + longest = len(result[i]) + } + } + + if longest > longFormThreshold { + indenter := strings.Repeat(Indent, int(indentation)) + return fmt.Sprintf("{\n%s%s,\n%s}", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) + } + return fmt.Sprintf("{%s}", strings.Join(result, ", ")) +} + +func formatStruct(v reflect.Value, indentation uint) string { + t := v.Type() + + l := v.NumField() + result := []string{} + longest := 0 + for i := 0; i < l; i++ { + structField := t.Field(i) + fieldEntry := v.Field(i) + representation := fmt.Sprintf("%s: %s", structField.Name, formatValue(fieldEntry, indentation+1)) + result = append(result, representation) + if len(representation) > longest { + longest = len(representation) + } + } + if longest > longFormThreshold { + indenter := strings.Repeat(Indent, int(indentation)) + return fmt.Sprintf("{\n%s%s,\n%s}", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) + } + return fmt.Sprintf("{%s}", strings.Join(result, ", ")) +} + +func isNilValue(a reflect.Value) bool { + switch a.Kind() { + case reflect.Invalid: + return true + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return a.IsNil() + } + + return false +} + +/* +Returns true when the string is entirely made of printable runes, false otherwise. +*/ +func isPrintableString(str string) bool { + for _, runeValue := range str { + if !strconv.IsPrint(runeValue) { + return false + } + } + return true +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/gomega_dsl.go new file mode 100644 index 0000000000..0d0f563a14 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -0,0 +1,335 @@ +/* +Gomega is the Ginkgo BDD-style testing framework's preferred matcher library. + +The godoc documentation describes Gomega's API. More comprehensive documentation (with examples!) is available at http://onsi.github.io/gomega/ + +Gomega on Github: http://github.com/onsi/gomega + +Learn more about Ginkgo online: http://onsi.github.io/ginkgo + +Ginkgo on Github: http://github.com/onsi/ginkgo + +Gomega is MIT-Licensed +*/ +package gomega + +import ( + "fmt" + "reflect" + "time" + + "github.com/onsi/gomega/internal/assertion" + "github.com/onsi/gomega/internal/asyncassertion" + "github.com/onsi/gomega/internal/testingtsupport" + "github.com/onsi/gomega/types" +) + +const GOMEGA_VERSION = "1.2.0" + +const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil. +If you're using Ginkgo then you probably forgot to put your assertion in an It(). +Alternatively, you may have forgotten to register a fail handler with RegisterFailHandler() or RegisterTestingT(). +` + +var globalFailHandler types.GomegaFailHandler + +var defaultEventuallyTimeout = time.Second +var defaultEventuallyPollingInterval = 10 * time.Millisecond +var defaultConsistentlyDuration = 100 * time.Millisecond +var defaultConsistentlyPollingInterval = 10 * time.Millisecond + +//RegisterFailHandler connects Ginkgo to Gomega. When a matcher fails +//the fail handler passed into RegisterFailHandler is called. +func RegisterFailHandler(handler types.GomegaFailHandler) { + globalFailHandler = handler +} + +//RegisterTestingT connects Gomega to Golang's XUnit style +//Testing.T tests. You'll need to call this at the top of each XUnit style test: +// +// func TestFarmHasCow(t *testing.T) { +// RegisterTestingT(t) +// +// f := farm.New([]string{"Cow", "Horse"}) +// Expect(f.HasCow()).To(BeTrue(), "Farm should have cow") +// } +// +// Note that this *testing.T is registered *globally* by Gomega (this is why you don't have to +// pass `t` down to the matcher itself). This means that you cannot run the XUnit style tests +// in parallel as the global fail handler cannot point to more than one testing.T at a time. +// +// (As an aside: Ginkgo gets around this limitation by running parallel tests in different *processes*). +func RegisterTestingT(t types.GomegaTestingT) { + RegisterFailHandler(testingtsupport.BuildTestingTGomegaFailHandler(t)) +} + +//InterceptGomegaHandlers runs a given callback and returns an array of +//failure messages generated by any Gomega assertions within the callback. +// +//This is accomplished by temporarily replacing the *global* fail handler +//with a fail handler that simply annotates failures. The original fail handler +//is reset when InterceptGomegaFailures returns. +// +//This is most useful when testing custom matchers, but can also be used to check +//on a value using a Gomega assertion without causing a test failure. +func InterceptGomegaFailures(f func()) []string { + originalHandler := globalFailHandler + failures := []string{} + RegisterFailHandler(func(message string, callerSkip ...int) { + failures = append(failures, message) + }) + f() + RegisterFailHandler(originalHandler) + return failures +} + +//Ω wraps an actual value allowing assertions to be made on it: +// Ω("foo").Should(Equal("foo")) +// +//If Ω is passed more than one argument it will pass the *first* argument to the matcher. +//All subsequent arguments will be required to be nil/zero. +// +//This is convenient if you want to make an assertion on a method/function that returns +//a value and an error - a common patter in Go. +// +//For example, given a function with signature: +// func MyAmazingThing() (int, error) +// +//Then: +// Ω(MyAmazingThing()).Should(Equal(3)) +//Will succeed only if `MyAmazingThing()` returns `(3, nil)` +// +//Ω and Expect are identical +func Ω(actual interface{}, extra ...interface{}) GomegaAssertion { + return ExpectWithOffset(0, actual, extra...) +} + +//Expect wraps an actual value allowing assertions to be made on it: +// Expect("foo").To(Equal("foo")) +// +//If Expect is passed more than one argument it will pass the *first* argument to the matcher. +//All subsequent arguments will be required to be nil/zero. +// +//This is convenient if you want to make an assertion on a method/function that returns +//a value and an error - a common patter in Go. +// +//For example, given a function with signature: +// func MyAmazingThing() (int, error) +// +//Then: +// Expect(MyAmazingThing()).Should(Equal(3)) +//Will succeed only if `MyAmazingThing()` returns `(3, nil)` +// +//Expect and Ω are identical +func Expect(actual interface{}, extra ...interface{}) GomegaAssertion { + return ExpectWithOffset(0, actual, extra...) +} + +//ExpectWithOffset wraps an actual value allowing assertions to be made on it: +// ExpectWithOffset(1, "foo").To(Equal("foo")) +// +//Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument +//this is used to modify the call-stack offset when computing line numbers. +// +//This is most useful in helper functions that make assertions. If you want Gomega's +//error message to refer to the calling line in the test (as opposed to the line in the helper function) +//set the first argument of `ExpectWithOffset` appropriately. +func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) GomegaAssertion { + if globalFailHandler == nil { + panic(nilFailHandlerPanic) + } + return assertion.New(actual, globalFailHandler, offset, extra...) +} + +//Eventually wraps an actual value allowing assertions to be made on it. +//The assertion is tried periodically until it passes or a timeout occurs. +// +//Both the timeout and polling interval are configurable as optional arguments: +//The first optional argument is the timeout +//The second optional argument is the polling interval +// +//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the +//last case they are interpreted as seconds. +// +//If Eventually is passed an actual that is a function taking no arguments and returning at least one value, +//then Eventually will call the function periodically and try the matcher against the function's first return value. +// +//Example: +// +// Eventually(func() int { +// return thingImPolling.Count() +// }).Should(BeNumerically(">=", 17)) +// +//Note that this example could be rewritten: +// +// Eventually(thingImPolling.Count).Should(BeNumerically(">=", 17)) +// +//If the function returns more than one value, then Eventually will pass the first value to the matcher and +//assert that all other values are nil/zero. +//This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go. +// +//For example, consider a method that returns a value and an error: +// func FetchFromDB() (string, error) +// +//Then +// Eventually(FetchFromDB).Should(Equal("hasselhoff")) +// +//Will pass only if the the returned error is nil and the returned string passes the matcher. +// +//Eventually's default timeout is 1 second, and its default polling interval is 10ms +func Eventually(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { + return EventuallyWithOffset(0, actual, intervals...) +} + +//EventuallyWithOffset operates like Eventually but takes an additional +//initial argument to indicate an offset in the call stack. This is useful when building helper +//functions that contain matchers. To learn more, read about `ExpectWithOffset`. +func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { + if globalFailHandler == nil { + panic(nilFailHandlerPanic) + } + timeoutInterval := defaultEventuallyTimeout + pollingInterval := defaultEventuallyPollingInterval + if len(intervals) > 0 { + timeoutInterval = toDuration(intervals[0]) + } + if len(intervals) > 1 { + pollingInterval = toDuration(intervals[1]) + } + return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, globalFailHandler, timeoutInterval, pollingInterval, offset) +} + +//Consistently wraps an actual value allowing assertions to be made on it. +//The assertion is tried periodically and is required to pass for a period of time. +// +//Both the total time and polling interval are configurable as optional arguments: +//The first optional argument is the duration that Consistently will run for +//The second optional argument is the polling interval +// +//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the +//last case they are interpreted as seconds. +// +//If Consistently is passed an actual that is a function taking no arguments and returning at least one value, +//then Consistently will call the function periodically and try the matcher against the function's first return value. +// +//If the function returns more than one value, then Consistently will pass the first value to the matcher and +//assert that all other values are nil/zero. +//This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go. +// +//Consistently is useful in cases where you want to assert that something *does not happen* over a period of tiem. +//For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could: +// +// Consistently(channel).ShouldNot(Receive()) +// +//Consistently's default duration is 100ms, and its default polling interval is 10ms +func Consistently(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { + return ConsistentlyWithOffset(0, actual, intervals...) +} + +//ConsistentlyWithOffset operates like Consistnetly but takes an additional +//initial argument to indicate an offset in the call stack. This is useful when building helper +//functions that contain matchers. To learn more, read about `ExpectWithOffset`. +func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { + if globalFailHandler == nil { + panic(nilFailHandlerPanic) + } + timeoutInterval := defaultConsistentlyDuration + pollingInterval := defaultConsistentlyPollingInterval + if len(intervals) > 0 { + timeoutInterval = toDuration(intervals[0]) + } + if len(intervals) > 1 { + pollingInterval = toDuration(intervals[1]) + } + return asyncassertion.New(asyncassertion.AsyncAssertionTypeConsistently, actual, globalFailHandler, timeoutInterval, pollingInterval, offset) +} + +//Set the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses. +func SetDefaultEventuallyTimeout(t time.Duration) { + defaultEventuallyTimeout = t +} + +//Set the default polling interval for Eventually. +func SetDefaultEventuallyPollingInterval(t time.Duration) { + defaultEventuallyPollingInterval = t +} + +//Set the default duration for Consistently. Consistently will verify that your condition is satsified for this long. +func SetDefaultConsistentlyDuration(t time.Duration) { + defaultConsistentlyDuration = t +} + +//Set the default polling interval for Consistently. +func SetDefaultConsistentlyPollingInterval(t time.Duration) { + defaultConsistentlyPollingInterval = t +} + +//GomegaAsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against +//the matcher passed to the Should and ShouldNot methods. +// +//Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to +//fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more +//descriptive +// +//Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed. +// +//Example: +// +// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") +// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.") +type GomegaAsyncAssertion interface { + Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool +} + +//GomegaAssertion is returned by Ω and Expect and compares the actual value to the matcher +//passed to the Should/ShouldNot and To/ToNot/NotTo methods. +// +//Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect +//though this is not enforced. +// +//All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf() +//and is used to annotate failure messages. +// +//All methods return a bool that is true if hte assertion passed and false if it failed. +// +//Example: +// +// Ω(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) +type GomegaAssertion interface { + Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + + To(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + ToNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool +} + +//OmegaMatcher is deprecated in favor of the better-named and better-organized types.GomegaMatcher but sticks around to support existing code that uses it +type OmegaMatcher types.GomegaMatcher + +func toDuration(input interface{}) time.Duration { + duration, ok := input.(time.Duration) + if ok { + return duration + } + + value := reflect.ValueOf(input) + kind := reflect.TypeOf(input).Kind() + + if reflect.Int <= kind && kind <= reflect.Int64 { + return time.Duration(value.Int()) * time.Second + } else if reflect.Uint <= kind && kind <= reflect.Uint64 { + return time.Duration(value.Uint()) * time.Second + } else if reflect.Float32 <= kind && kind <= reflect.Float64 { + return time.Duration(value.Float() * float64(time.Second)) + } else if reflect.String == kind { + duration, err := time.ParseDuration(value.String()) + if err != nil { + panic(fmt.Sprintf("%#v is not a valid parsable duration string.", input)) + } + return duration + } + + panic(fmt.Sprintf("%v is not a valid interval. Must be time.Duration, parsable duration string or a number.", input)) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/assertion/assertion.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/assertion/assertion.go new file mode 100644 index 0000000000..b73673f21e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/assertion/assertion.go @@ -0,0 +1,98 @@ +package assertion + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/types" +) + +type Assertion struct { + actualInput interface{} + fail types.GomegaFailHandler + offset int + extra []interface{} +} + +func New(actualInput interface{}, fail types.GomegaFailHandler, offset int, extra ...interface{}) *Assertion { + return &Assertion{ + actualInput: actualInput, + fail: fail, + offset: offset, + extra: extra, + } +} + +func (assertion *Assertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, true, optionalDescription...) +} + +func (assertion *Assertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) +} + +func (assertion *Assertion) To(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, true, optionalDescription...) +} + +func (assertion *Assertion) ToNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) +} + +func (assertion *Assertion) NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) +} + +func (assertion *Assertion) buildDescription(optionalDescription ...interface{}) string { + switch len(optionalDescription) { + case 0: + return "" + default: + return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" + } +} + +func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { + matches, err := matcher.Match(assertion.actualInput) + description := assertion.buildDescription(optionalDescription...) + if err != nil { + assertion.fail(description+err.Error(), 2+assertion.offset) + return false + } + if matches != desiredMatch { + var message string + if desiredMatch { + message = matcher.FailureMessage(assertion.actualInput) + } else { + message = matcher.NegatedFailureMessage(assertion.actualInput) + } + assertion.fail(description+message, 2+assertion.offset) + return false + } + + return true +} + +func (assertion *Assertion) vetExtras(optionalDescription ...interface{}) bool { + success, message := vetExtras(assertion.extra) + if success { + return true + } + + description := assertion.buildDescription(optionalDescription...) + assertion.fail(description+message, 2+assertion.offset) + return false +} + +func vetExtras(extras []interface{}) (bool, string) { + for i, extra := range extras { + if extra != nil { + zeroValue := reflect.Zero(reflect.TypeOf(extra)).Interface() + if !reflect.DeepEqual(zeroValue, extra) { + message := fmt.Sprintf("Unexpected non-nil/non-zero extra argument at index %d:\n\t<%T>: %#v", i+1, extra, extra) + return false, message + } + } + } + return true, "" +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go new file mode 100644 index 0000000000..bce0853006 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go @@ -0,0 +1,189 @@ +package asyncassertion + +import ( + "errors" + "fmt" + "reflect" + "time" + + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type AsyncAssertionType uint + +const ( + AsyncAssertionTypeEventually AsyncAssertionType = iota + AsyncAssertionTypeConsistently +) + +type AsyncAssertion struct { + asyncType AsyncAssertionType + actualInput interface{} + timeoutInterval time.Duration + pollingInterval time.Duration + fail types.GomegaFailHandler + offset int +} + +func New(asyncType AsyncAssertionType, actualInput interface{}, fail types.GomegaFailHandler, timeoutInterval time.Duration, pollingInterval time.Duration, offset int) *AsyncAssertion { + actualType := reflect.TypeOf(actualInput) + if actualType.Kind() == reflect.Func { + if actualType.NumIn() != 0 || actualType.NumOut() == 0 { + panic("Expected a function with no arguments and one or more return values.") + } + } + + return &AsyncAssertion{ + asyncType: asyncType, + actualInput: actualInput, + fail: fail, + timeoutInterval: timeoutInterval, + pollingInterval: pollingInterval, + offset: offset, + } +} + +func (assertion *AsyncAssertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.match(matcher, true, optionalDescription...) +} + +func (assertion *AsyncAssertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.match(matcher, false, optionalDescription...) +} + +func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interface{}) string { + switch len(optionalDescription) { + case 0: + return "" + default: + return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" + } +} + +func (assertion *AsyncAssertion) actualInputIsAFunction() bool { + actualType := reflect.TypeOf(assertion.actualInput) + return actualType.Kind() == reflect.Func && actualType.NumIn() == 0 && actualType.NumOut() > 0 +} + +func (assertion *AsyncAssertion) pollActual() (interface{}, error) { + if assertion.actualInputIsAFunction() { + values := reflect.ValueOf(assertion.actualInput).Call([]reflect.Value{}) + + extras := []interface{}{} + for _, value := range values[1:] { + extras = append(extras, value.Interface()) + } + + success, message := vetExtras(extras) + + if !success { + return nil, errors.New(message) + } + + return values[0].Interface(), nil + } + + return assertion.actualInput, nil +} + +func (assertion *AsyncAssertion) matcherMayChange(matcher types.GomegaMatcher, value interface{}) bool { + if assertion.actualInputIsAFunction() { + return true + } + + return oraclematcher.MatchMayChangeInTheFuture(matcher, value) +} + +func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { + timer := time.Now() + timeout := time.After(assertion.timeoutInterval) + + description := assertion.buildDescription(optionalDescription...) + + var matches bool + var err error + mayChange := true + value, err := assertion.pollActual() + if err == nil { + mayChange = assertion.matcherMayChange(matcher, value) + matches, err = matcher.Match(value) + } + + fail := func(preamble string) { + errMsg := "" + message := "" + if err != nil { + errMsg = "Error: " + err.Error() + } else { + if desiredMatch { + message = matcher.FailureMessage(value) + } else { + message = matcher.NegatedFailureMessage(value) + } + } + assertion.fail(fmt.Sprintf("%s after %.3fs.\n%s%s%s", preamble, time.Since(timer).Seconds(), description, message, errMsg), 3+assertion.offset) + } + + if assertion.asyncType == AsyncAssertionTypeEventually { + for { + if err == nil && matches == desiredMatch { + return true + } + + if !mayChange { + fail("No future change is possible. Bailing out early") + return false + } + + select { + case <-time.After(assertion.pollingInterval): + value, err = assertion.pollActual() + if err == nil { + mayChange = assertion.matcherMayChange(matcher, value) + matches, err = matcher.Match(value) + } + case <-timeout: + fail("Timed out") + return false + } + } + } else if assertion.asyncType == AsyncAssertionTypeConsistently { + for { + if !(err == nil && matches == desiredMatch) { + fail("Failed") + return false + } + + if !mayChange { + return true + } + + select { + case <-time.After(assertion.pollingInterval): + value, err = assertion.pollActual() + if err == nil { + mayChange = assertion.matcherMayChange(matcher, value) + matches, err = matcher.Match(value) + } + case <-timeout: + return true + } + } + } + + return false +} + +func vetExtras(extras []interface{}) (bool, string) { + for i, extra := range extras { + if extra != nil { + zeroValue := reflect.Zero(reflect.TypeOf(extra)).Interface() + if !reflect.DeepEqual(zeroValue, extra) { + message := fmt.Sprintf("Unexpected non-nil/non-zero extra argument at index %d:\n\t<%T>: %#v", i+1, extra, extra) + return false, message + } + } + } + return true, "" +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/oraclematcher/oracle_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/oraclematcher/oracle_matcher.go new file mode 100644 index 0000000000..66cad88a1f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/oraclematcher/oracle_matcher.go @@ -0,0 +1,25 @@ +package oraclematcher + +import "github.com/onsi/gomega/types" + +/* +GomegaMatchers that also match the OracleMatcher interface can convey information about +whether or not their result will change upon future attempts. + +This allows `Eventually` and `Consistently` to short circuit if success becomes impossible. + +For example, a process' exit code can never change. So, gexec's Exit matcher returns `true` +for `MatchMayChangeInTheFuture` until the process exits, at which point it returns `false` forevermore. +*/ +type OracleMatcher interface { + MatchMayChangeInTheFuture(actual interface{}) bool +} + +func MatchMayChangeInTheFuture(matcher types.GomegaMatcher, value interface{}) bool { + oracleMatcher, ok := matcher.(OracleMatcher) + if !ok { + return true + } + + return oracleMatcher.MatchMayChangeInTheFuture(value) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go new file mode 100644 index 0000000000..ac8912525a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go @@ -0,0 +1,40 @@ +package testingtsupport + +import ( + "regexp" + "runtime/debug" + "strings" + + "github.com/onsi/gomega/types" +) + +type gomegaTestingT interface { + Fatalf(format string, args ...interface{}) +} + +func BuildTestingTGomegaFailHandler(t gomegaTestingT) types.GomegaFailHandler { + return func(message string, callerSkip ...int) { + skip := 1 + if len(callerSkip) > 0 { + skip = callerSkip[0] + } + stackTrace := pruneStack(string(debug.Stack()), skip) + t.Fatalf("\n%s\n%s", stackTrace, message) + } +} + +func pruneStack(fullStackTrace string, skip int) string { + stack := strings.Split(fullStackTrace, "\n") + if len(stack) > 2*(skip+1) { + stack = stack[2*(skip+1):] + } + prunedStack := []string{} + re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) + for i := 0; i < len(stack)/2; i++ { + if !re.Match([]byte(stack[i*2])) { + prunedStack = append(prunedStack, stack[i*2]) + prunedStack = append(prunedStack, stack[i*2+1]) + } + } + return strings.Join(prunedStack, "\n") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers.go new file mode 100644 index 0000000000..e6e85d070d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers.go @@ -0,0 +1,427 @@ +package gomega + +import ( + "time" + + "github.com/onsi/gomega/matchers" + "github.com/onsi/gomega/types" +) + +//Equal uses reflect.DeepEqual to compare actual with expected. Equal is strict about +//types when performing comparisons. +//It is an error for both actual and expected to be nil. Use BeNil() instead. +func Equal(expected interface{}) types.GomegaMatcher { + return &matchers.EqualMatcher{ + Expected: expected, + } +} + +//BeEquivalentTo is more lax than Equal, allowing equality between different types. +//This is done by converting actual to have the type of expected before +//attempting equality with reflect.DeepEqual. +//It is an error for actual and expected to be nil. Use BeNil() instead. +func BeEquivalentTo(expected interface{}) types.GomegaMatcher { + return &matchers.BeEquivalentToMatcher{ + Expected: expected, + } +} + +//BeIdenticalTo uses the == operator to compare actual with expected. +//BeIdenticalTo is strict about types when performing comparisons. +//It is an error for both actual and expected to be nil. Use BeNil() instead. +func BeIdenticalTo(expected interface{}) types.GomegaMatcher { + return &matchers.BeIdenticalToMatcher{ + Expected: expected, + } +} + +//BeNil succeeds if actual is nil +func BeNil() types.GomegaMatcher { + return &matchers.BeNilMatcher{} +} + +//BeTrue succeeds if actual is true +func BeTrue() types.GomegaMatcher { + return &matchers.BeTrueMatcher{} +} + +//BeFalse succeeds if actual is false +func BeFalse() types.GomegaMatcher { + return &matchers.BeFalseMatcher{} +} + +//HaveOccurred succeeds if actual is a non-nil error +//The typical Go error checking pattern looks like: +// err := SomethingThatMightFail() +// Ω(err).ShouldNot(HaveOccurred()) +func HaveOccurred() types.GomegaMatcher { + return &matchers.HaveOccurredMatcher{} +} + +//Succeed passes if actual is a nil error +//Succeed is intended to be used with functions that return a single error value. Instead of +// err := SomethingThatMightFail() +// Ω(err).ShouldNot(HaveOccurred()) +// +//You can write: +// Ω(SomethingThatMightFail()).Should(Succeed()) +// +//It is a mistake to use Succeed with a function that has multiple return values. Gomega's Ω and Expect +//functions automatically trigger failure if any return values after the first return value are non-zero/non-nil. +//This means that Ω(MultiReturnFunc()).ShouldNot(Succeed()) can never pass. +func Succeed() types.GomegaMatcher { + return &matchers.SucceedMatcher{} +} + +//MatchError succeeds if actual is a non-nil error that matches the passed in string/error. +// +//These are valid use-cases: +// Ω(err).Should(MatchError("an error")) //asserts that err.Error() == "an error" +// Ω(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual) +// +//It is an error for err to be nil or an object that does not implement the Error interface +func MatchError(expected interface{}) types.GomegaMatcher { + return &matchers.MatchErrorMatcher{ + Expected: expected, + } +} + +//BeClosed succeeds if actual is a closed channel. +//It is an error to pass a non-channel to BeClosed, it is also an error to pass nil +// +//In order to check whether or not the channel is closed, Gomega must try to read from the channel +//(even in the `ShouldNot(BeClosed())` case). You should keep this in mind if you wish to make subsequent assertions about +//values coming down the channel. +// +//Also, if you are testing that a *buffered* channel is closed you must first read all values out of the channel before +//asserting that it is closed (it is not possible to detect that a buffered-channel has been closed until all its buffered values are read). +// +//Finally, as a corollary: it is an error to check whether or not a send-only channel is closed. +func BeClosed() types.GomegaMatcher { + return &matchers.BeClosedMatcher{} +} + +//Receive succeeds if there is a value to be received on actual. +//Actual must be a channel (and cannot be a send-only channel) -- anything else is an error. +// +//Receive returns immediately and never blocks: +// +//- If there is nothing on the channel `c` then Ω(c).Should(Receive()) will fail and Ω(c).ShouldNot(Receive()) will pass. +// +//- If the channel `c` is closed then Ω(c).Should(Receive()) will fail and Ω(c).ShouldNot(Receive()) will pass. +// +//- If there is something on the channel `c` ready to be read, then Ω(c).Should(Receive()) will pass and Ω(c).ShouldNot(Receive()) will fail. +// +//If you have a go-routine running in the background that will write to channel `c` you can: +// Eventually(c).Should(Receive()) +// +//This will timeout if nothing gets sent to `c` (you can modify the timeout interval as you normally do with `Eventually`) +// +//A similar use-case is to assert that no go-routine writes to a channel (for a period of time). You can do this with `Consistently`: +// Consistently(c).ShouldNot(Receive()) +// +//You can pass `Receive` a matcher. If you do so, it will match the received object against the matcher. For example: +// Ω(c).Should(Receive(Equal("foo"))) +// +//When given a matcher, `Receive` will always fail if there is nothing to be received on the channel. +// +//Passing Receive a matcher is especially useful when paired with Eventually: +// +// Eventually(c).Should(Receive(ContainSubstring("bar"))) +// +//will repeatedly attempt to pull values out of `c` until a value matching "bar" is received. +// +//Finally, if you want to have a reference to the value *sent* to the channel you can pass the `Receive` matcher a pointer to a variable of the appropriate type: +// var myThing thing +// Eventually(thingChan).Should(Receive(&myThing)) +// Ω(myThing.Sprocket).Should(Equal("foo")) +// Ω(myThing.IsValid()).Should(BeTrue()) +func Receive(args ...interface{}) types.GomegaMatcher { + var arg interface{} + if len(args) > 0 { + arg = args[0] + } + + return &matchers.ReceiveMatcher{ + Arg: arg, + } +} + +//BeSent succeeds if a value can be sent to actual. +//Actual must be a channel (and cannot be a receive-only channel) that can sent the type of the value passed into BeSent -- anything else is an error. +//In addition, actual must not be closed. +// +//BeSent never blocks: +// +//- If the channel `c` is not ready to receive then Ω(c).Should(BeSent("foo")) will fail immediately +//- If the channel `c` is eventually ready to receive then Eventually(c).Should(BeSent("foo")) will succeed.. presuming the channel becomes ready to receive before Eventually's timeout +//- If the channel `c` is closed then Ω(c).Should(BeSent("foo")) and Ω(c).ShouldNot(BeSent("foo")) will both fail immediately +// +//Of course, the value is actually sent to the channel. The point of `BeSent` is less to make an assertion about the availability of the channel (which is typically an implementation detail that your test should not be concerned with). +//Rather, the point of `BeSent` is to make it possible to easily and expressively write tests that can timeout on blocked channel sends. +func BeSent(arg interface{}) types.GomegaMatcher { + return &matchers.BeSentMatcher{ + Arg: arg, + } +} + +//MatchRegexp succeeds if actual is a string or stringer that matches the +//passed-in regexp. Optional arguments can be provided to construct a regexp +//via fmt.Sprintf(). +func MatchRegexp(regexp string, args ...interface{}) types.GomegaMatcher { + return &matchers.MatchRegexpMatcher{ + Regexp: regexp, + Args: args, + } +} + +//ContainSubstring succeeds if actual is a string or stringer that contains the +//passed-in substring. Optional arguments can be provided to construct the substring +//via fmt.Sprintf(). +func ContainSubstring(substr string, args ...interface{}) types.GomegaMatcher { + return &matchers.ContainSubstringMatcher{ + Substr: substr, + Args: args, + } +} + +//HavePrefix succeeds if actual is a string or stringer that contains the +//passed-in string as a prefix. Optional arguments can be provided to construct +//via fmt.Sprintf(). +func HavePrefix(prefix string, args ...interface{}) types.GomegaMatcher { + return &matchers.HavePrefixMatcher{ + Prefix: prefix, + Args: args, + } +} + +//HaveSuffix succeeds if actual is a string or stringer that contains the +//passed-in string as a suffix. Optional arguments can be provided to construct +//via fmt.Sprintf(). +func HaveSuffix(suffix string, args ...interface{}) types.GomegaMatcher { + return &matchers.HaveSuffixMatcher{ + Suffix: suffix, + Args: args, + } +} + +//MatchJSON succeeds if actual is a string or stringer of JSON that matches +//the expected JSON. The JSONs are decoded and the resulting objects are compared via +//reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. +func MatchJSON(json interface{}) types.GomegaMatcher { + return &matchers.MatchJSONMatcher{ + JSONToMatch: json, + } +} + +//MatchXML succeeds if actual is a string or stringer of XML that matches +//the expected XML. The XMLs are decoded and the resulting objects are compared via +//reflect.DeepEqual so things like whitespaces shouldn't matter. +func MatchXML(xml interface{}) types.GomegaMatcher { + return &matchers.MatchXMLMatcher{ + XMLToMatch: xml, + } +} + +//MatchYAML succeeds if actual is a string or stringer of YAML that matches +//the expected YAML. The YAML's are decoded and the resulting objects are compared via +//reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. +func MatchYAML(yaml interface{}) types.GomegaMatcher { + return &matchers.MatchYAMLMatcher{ + YAMLToMatch: yaml, + } +} + +//BeEmpty succeeds if actual is empty. Actual must be of type string, array, map, chan, or slice. +func BeEmpty() types.GomegaMatcher { + return &matchers.BeEmptyMatcher{} +} + +//HaveLen succeeds if actual has the passed-in length. Actual must be of type string, array, map, chan, or slice. +func HaveLen(count int) types.GomegaMatcher { + return &matchers.HaveLenMatcher{ + Count: count, + } +} + +//HaveCap succeeds if actual has the passed-in capacity. Actual must be of type array, chan, or slice. +func HaveCap(count int) types.GomegaMatcher { + return &matchers.HaveCapMatcher{ + Count: count, + } +} + +//BeZero succeeds if actual is the zero value for its type or if actual is nil. +func BeZero() types.GomegaMatcher { + return &matchers.BeZeroMatcher{} +} + +//ContainElement succeeds if actual contains the passed in element. +//By default ContainElement() uses Equal() to perform the match, however a +//matcher can be passed in instead: +// Ω([]string{"Foo", "FooBar"}).Should(ContainElement(ContainSubstring("Bar"))) +// +//Actual must be an array, slice or map. +//For maps, ContainElement searches through the map's values. +func ContainElement(element interface{}) types.GomegaMatcher { + return &matchers.ContainElementMatcher{ + Element: element, + } +} + +//ConsistOf succeeds if actual contains preciely the elements passed into the matcher. The ordering of the elements does not matter. +//By default ConsistOf() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: +// +// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf("FooBar", "Foo")) +// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Bar"), "Foo")) +// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Foo"), ContainSubstring("Foo"))) +// +//Actual must be an array, slice or map. For maps, ConsistOf matches against the map's values. +// +//You typically pass variadic arguments to ConsistOf (as in the examples above). However, if you need to pass in a slice you can provided that it +//is the only element passed in to ConsistOf: +// +// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf([]string{"FooBar", "Foo"})) +// +//Note that Go's type system does not allow you to write this as ConsistOf([]string{"FooBar", "Foo"}...) as []string and []interface{} are different types - hence the need for this special rule. +func ConsistOf(elements ...interface{}) types.GomegaMatcher { + return &matchers.ConsistOfMatcher{ + Elements: elements, + } +} + +//HaveKey succeeds if actual is a map with the passed in key. +//By default HaveKey uses Equal() to perform the match, however a +//matcher can be passed in instead: +// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKey(MatchRegexp(`.+Foo$`))) +func HaveKey(key interface{}) types.GomegaMatcher { + return &matchers.HaveKeyMatcher{ + Key: key, + } +} + +//HaveKeyWithValue succeeds if actual is a map with the passed in key and value. +//By default HaveKeyWithValue uses Equal() to perform the match, however a +//matcher can be passed in instead: +// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue("Foo", "Bar")) +// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue(MatchRegexp(`.+Foo$`), "Bar")) +func HaveKeyWithValue(key interface{}, value interface{}) types.GomegaMatcher { + return &matchers.HaveKeyWithValueMatcher{ + Key: key, + Value: value, + } +} + +//BeNumerically performs numerical assertions in a type-agnostic way. +//Actual and expected should be numbers, though the specific type of +//number is irrelevant (floa32, float64, uint8, etc...). +// +//There are six, self-explanatory, supported comparators: +// Ω(1.0).Should(BeNumerically("==", 1)) +// Ω(1.0).Should(BeNumerically("~", 0.999, 0.01)) +// Ω(1.0).Should(BeNumerically(">", 0.9)) +// Ω(1.0).Should(BeNumerically(">=", 1.0)) +// Ω(1.0).Should(BeNumerically("<", 3)) +// Ω(1.0).Should(BeNumerically("<=", 1.0)) +func BeNumerically(comparator string, compareTo ...interface{}) types.GomegaMatcher { + return &matchers.BeNumericallyMatcher{ + Comparator: comparator, + CompareTo: compareTo, + } +} + +//BeTemporally compares time.Time's like BeNumerically +//Actual and expected must be time.Time. The comparators are the same as for BeNumerically +// Ω(time.Now()).Should(BeTemporally(">", time.Time{})) +// Ω(time.Now()).Should(BeTemporally("~", time.Now(), time.Second)) +func BeTemporally(comparator string, compareTo time.Time, threshold ...time.Duration) types.GomegaMatcher { + return &matchers.BeTemporallyMatcher{ + Comparator: comparator, + CompareTo: compareTo, + Threshold: threshold, + } +} + +//BeAssignableToTypeOf succeeds if actual is assignable to the type of expected. +//It will return an error when one of the values is nil. +// Ω(0).Should(BeAssignableToTypeOf(0)) // Same values +// Ω(5).Should(BeAssignableToTypeOf(-1)) // different values same type +// Ω("foo").Should(BeAssignableToTypeOf("bar")) // different values same type +// Ω(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) +func BeAssignableToTypeOf(expected interface{}) types.GomegaMatcher { + return &matchers.AssignableToTypeOfMatcher{ + Expected: expected, + } +} + +//Panic succeeds if actual is a function that, when invoked, panics. +//Actual must be a function that takes no arguments and returns no results. +func Panic() types.GomegaMatcher { + return &matchers.PanicMatcher{} +} + +//BeAnExistingFile succeeds if a file exists. +//Actual must be a string representing the abs path to the file being checked. +func BeAnExistingFile() types.GomegaMatcher { + return &matchers.BeAnExistingFileMatcher{} +} + +//BeARegularFile succeeds iff a file exists and is a regular file. +//Actual must be a string representing the abs path to the file being checked. +func BeARegularFile() types.GomegaMatcher { + return &matchers.BeARegularFileMatcher{} +} + +//BeADirectory succeeds iff a file exists and is a directory. +//Actual must be a string representing the abs path to the file being checked. +func BeADirectory() types.GomegaMatcher { + return &matchers.BeADirectoryMatcher{} +} + +//And succeeds only if all of the given matchers succeed. +//The matchers are tried in order, and will fail-fast if one doesn't succeed. +// Expect("hi").To(And(HaveLen(2), Equal("hi")) +// +//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +func And(ms ...types.GomegaMatcher) types.GomegaMatcher { + return &matchers.AndMatcher{Matchers: ms} +} + +//SatisfyAll is an alias for And(). +// Ω("hi").Should(SatisfyAll(HaveLen(2), Equal("hi"))) +func SatisfyAll(matchers ...types.GomegaMatcher) types.GomegaMatcher { + return And(matchers...) +} + +//Or succeeds if any of the given matchers succeed. +//The matchers are tried in order and will return immediately upon the first successful match. +// Expect("hi").To(Or(HaveLen(3), HaveLen(2)) +// +//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +func Or(ms ...types.GomegaMatcher) types.GomegaMatcher { + return &matchers.OrMatcher{Matchers: ms} +} + +//SatisfyAny is an alias for Or(). +// Expect("hi").SatisfyAny(Or(HaveLen(3), HaveLen(2)) +func SatisfyAny(matchers ...types.GomegaMatcher) types.GomegaMatcher { + return Or(matchers...) +} + +//Not negates the given matcher; it succeeds if the given matcher fails. +// Expect(1).To(Not(Equal(2)) +// +//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +func Not(matcher types.GomegaMatcher) types.GomegaMatcher { + return &matchers.NotMatcher{Matcher: matcher} +} + +//WithTransform applies the `transform` to the actual value and matches it against `matcher`. +//The given transform must be a function of one parameter that returns one value. +// var plus1 = func(i int) int { return i + 1 } +// Expect(1).To(WithTransform(plus1, Equal(2)) +// +//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +func WithTransform(transform interface{}, matcher types.GomegaMatcher) types.GomegaMatcher { + return matchers.NewWithTransformMatcher(transform, matcher) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/and.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/and.go new file mode 100644 index 0000000000..d83a29164c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/and.go @@ -0,0 +1,63 @@ +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type AndMatcher struct { + Matchers []types.GomegaMatcher + + // state + firstFailedMatcher types.GomegaMatcher +} + +func (m *AndMatcher) Match(actual interface{}) (success bool, err error) { + m.firstFailedMatcher = nil + for _, matcher := range m.Matchers { + success, err := matcher.Match(actual) + if !success || err != nil { + m.firstFailedMatcher = matcher + return false, err + } + } + return true, nil +} + +func (m *AndMatcher) FailureMessage(actual interface{}) (message string) { + return m.firstFailedMatcher.FailureMessage(actual) +} + +func (m *AndMatcher) NegatedFailureMessage(actual interface{}) (message string) { + // not the most beautiful list of matchers, but not bad either... + return format.Message(actual, fmt.Sprintf("To not satisfy all of these matchers: %s", m.Matchers)) +} + +func (m *AndMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + /* + Example with 3 matchers: A, B, C + + Match evaluates them: T, F, => F + So match is currently F, what should MatchMayChangeInTheFuture() return? + Seems like it only depends on B, since currently B MUST change to allow the result to become T + + Match eval: T, T, T => T + So match is currently T, what should MatchMayChangeInTheFuture() return? + Seems to depend on ANY of them being able to change to F. + */ + + if m.firstFailedMatcher == nil { + // so all matchers succeeded.. Any one of them changing would change the result. + for _, matcher := range m.Matchers { + if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) { + return true + } + } + return false // none of were going to change + } + // one of the matchers failed.. it must be able to change in order to affect the result + return oraclematcher.MatchMayChangeInTheFuture(m.firstFailedMatcher, actual) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go new file mode 100644 index 0000000000..89a1fc2116 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go @@ -0,0 +1,31 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type AssignableToTypeOfMatcher struct { + Expected interface{} +} + +func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil || matcher.Expected == nil { + return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") + } + + actualType := reflect.TypeOf(actual) + expectedType := reflect.TypeOf(matcher.Expected) + + return actualType.AssignableTo(expectedType), nil +} + +func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual interface{}) string { + return format.Message(actual, fmt.Sprintf("to be assignable to the type: %T", matcher.Expected)) +} + +func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string { + return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected)) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_a_directory.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_a_directory.go new file mode 100644 index 0000000000..7b6975e41e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_a_directory.go @@ -0,0 +1,54 @@ +package matchers + +import ( + "fmt" + "os" + + "github.com/onsi/gomega/format" +) + +type notADirectoryError struct { + os.FileInfo +} + +func (t notADirectoryError) Error() string { + fileInfo := os.FileInfo(t) + switch { + case fileInfo.Mode().IsRegular(): + return "file is a regular file" + default: + return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) + } +} + +type BeADirectoryMatcher struct { + expected interface{} + err error +} + +func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err error) { + actualFilename, ok := actual.(string) + if !ok { + return false, fmt.Errorf("BeADirectoryMatcher matcher expects a file path") + } + + fileInfo, err := os.Stat(actualFilename) + if err != nil { + matcher.err = err + return false, nil + } + + if !fileInfo.Mode().IsDir() { + matcher.err = notADirectoryError{fileInfo} + return false, nil + } + return true, nil +} + +func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to be a directory: %s", matcher.err)) +} + +func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not be a directory")) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go new file mode 100644 index 0000000000..e239131fb6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go @@ -0,0 +1,54 @@ +package matchers + +import ( + "fmt" + "os" + + "github.com/onsi/gomega/format" +) + +type notARegularFileError struct { + os.FileInfo +} + +func (t notARegularFileError) Error() string { + fileInfo := os.FileInfo(t) + switch { + case fileInfo.IsDir(): + return "file is a directory" + default: + return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) + } +} + +type BeARegularFileMatcher struct { + expected interface{} + err error +} + +func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, err error) { + actualFilename, ok := actual.(string) + if !ok { + return false, fmt.Errorf("BeARegularFileMatcher matcher expects a file path") + } + + fileInfo, err := os.Stat(actualFilename) + if err != nil { + matcher.err = err + return false, nil + } + + if !fileInfo.Mode().IsRegular() { + matcher.err = notARegularFileError{fileInfo} + return false, nil + } + return true, nil +} + +func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to be a regular file: %s", matcher.err)) +} + +func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not be a regular file")) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go new file mode 100644 index 0000000000..d42eba2234 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go @@ -0,0 +1,38 @@ +package matchers + +import ( + "fmt" + "os" + + "github.com/onsi/gomega/format" +) + +type BeAnExistingFileMatcher struct { + expected interface{} +} + +func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) { + actualFilename, ok := actual.(string) + if !ok { + return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path") + } + + if _, err = os.Stat(actualFilename); err != nil { + switch { + case os.IsNotExist(err): + return false, nil + default: + return false, err + } + } + + return true, nil +} + +func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to exist")) +} + +func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not to exist")) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go new file mode 100644 index 0000000000..c1b499597d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go @@ -0,0 +1,45 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type BeClosedMatcher struct { +} + +func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err error) { + if !isChan(actual) { + return false, fmt.Errorf("BeClosed matcher expects a channel. Got:\n%s", format.Object(actual, 1)) + } + + channelType := reflect.TypeOf(actual) + channelValue := reflect.ValueOf(actual) + + if channelType.ChanDir() == reflect.SendDir { + return false, fmt.Errorf("BeClosed matcher cannot determine if a send-only channel is closed or open. Got:\n%s", format.Object(actual, 1)) + } + + winnerIndex, _, open := reflect.Select([]reflect.SelectCase{ + reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, + }) + + var closed bool + if winnerIndex == 0 { + closed = !open + } else if winnerIndex == 1 { + closed = false + } + + return closed, nil +} + +func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be closed") +} + +func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be open") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go new file mode 100644 index 0000000000..55bdd7d15d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go @@ -0,0 +1,26 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type BeEmptyMatcher struct { +} + +func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) { + length, ok := lengthOf(actual) + if !ok { + return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) + } + + return length == 0, nil +} + +func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be empty") +} + +func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be empty") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go new file mode 100644 index 0000000000..32a0c3108a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go @@ -0,0 +1,33 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type BeEquivalentToMatcher struct { + Expected interface{} +} + +func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil && matcher.Expected == nil { + return false, fmt.Errorf("Both actual and expected must not be nil.") + } + + convertedActual := actual + + if actual != nil && matcher.Expected != nil && reflect.TypeOf(actual).ConvertibleTo(reflect.TypeOf(matcher.Expected)) { + convertedActual = reflect.ValueOf(actual).Convert(reflect.TypeOf(matcher.Expected)).Interface() + } + + return reflect.DeepEqual(convertedActual, matcher.Expected), nil +} + +func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be equivalent to", matcher.Expected) +} + +func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be equivalent to", matcher.Expected) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go new file mode 100644 index 0000000000..0b224cbbc6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go @@ -0,0 +1,25 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type BeFalseMatcher struct { +} + +func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { + if !isBool(actual) { + return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) + } + + return actual == false, nil +} + +func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be false") +} + +func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be false") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_identical_to.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_identical_to.go new file mode 100644 index 0000000000..fdcda4d1fb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_identical_to.go @@ -0,0 +1,37 @@ +package matchers + +import ( + "fmt" + "runtime" + + "github.com/onsi/gomega/format" +) + +type BeIdenticalToMatcher struct { + Expected interface{} +} + +func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, matchErr error) { + if actual == nil && matcher.Expected == nil { + return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") + } + + defer func() { + if r := recover(); r != nil { + if _, ok := r.(runtime.Error); ok { + success = false + matchErr = nil + } + } + }() + + return actual == matcher.Expected, nil +} + +func (matcher *BeIdenticalToMatcher) FailureMessage(actual interface{}) string { + return format.Message(actual, "to be identical to", matcher.Expected) +} + +func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual interface{}) string { + return format.Message(actual, "not to be identical to", matcher.Expected) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go new file mode 100644 index 0000000000..7ee84fe1bc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go @@ -0,0 +1,18 @@ +package matchers + +import "github.com/onsi/gomega/format" + +type BeNilMatcher struct { +} + +func (matcher *BeNilMatcher) Match(actual interface{}) (success bool, err error) { + return isNil(actual), nil +} + +func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be nil") +} + +func (matcher *BeNilMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be nil") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go new file mode 100644 index 0000000000..0c157f61b9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go @@ -0,0 +1,120 @@ +package matchers + +import ( + "fmt" + "math" + + "github.com/onsi/gomega/format" +) + +type BeNumericallyMatcher struct { + Comparator string + CompareTo []interface{} +} + +func (matcher *BeNumericallyMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo[0]) +} + +func (matcher *BeNumericallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo[0]) +} + +func (matcher *BeNumericallyMatcher) Match(actual interface{}) (success bool, err error) { + if len(matcher.CompareTo) == 0 || len(matcher.CompareTo) > 2 { + return false, fmt.Errorf("BeNumerically requires 1 or 2 CompareTo arguments. Got:\n%s", format.Object(matcher.CompareTo, 1)) + } + if !isNumber(actual) { + return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(actual, 1)) + } + if !isNumber(matcher.CompareTo[0]) { + return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1)) + } + if len(matcher.CompareTo) == 2 && !isNumber(matcher.CompareTo[1]) { + return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1)) + } + + switch matcher.Comparator { + case "==", "~", ">", ">=", "<", "<=": + default: + return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator) + } + + if isFloat(actual) || isFloat(matcher.CompareTo[0]) { + var secondOperand float64 = 1e-8 + if len(matcher.CompareTo) == 2 { + secondOperand = toFloat(matcher.CompareTo[1]) + } + success = matcher.matchFloats(toFloat(actual), toFloat(matcher.CompareTo[0]), secondOperand) + } else if isInteger(actual) { + var secondOperand int64 = 0 + if len(matcher.CompareTo) == 2 { + secondOperand = toInteger(matcher.CompareTo[1]) + } + success = matcher.matchIntegers(toInteger(actual), toInteger(matcher.CompareTo[0]), secondOperand) + } else if isUnsignedInteger(actual) { + var secondOperand uint64 = 0 + if len(matcher.CompareTo) == 2 { + secondOperand = toUnsignedInteger(matcher.CompareTo[1]) + } + success = matcher.matchUnsignedIntegers(toUnsignedInteger(actual), toUnsignedInteger(matcher.CompareTo[0]), secondOperand) + } else { + return false, fmt.Errorf("Failed to compare:\n%s\n%s:\n%s", format.Object(actual, 1), matcher.Comparator, format.Object(matcher.CompareTo[0], 1)) + } + + return success, nil +} + +func (matcher *BeNumericallyMatcher) matchIntegers(actual, compareTo, threshold int64) (success bool) { + switch matcher.Comparator { + case "==", "~": + diff := actual - compareTo + return -threshold <= diff && diff <= threshold + case ">": + return (actual > compareTo) + case ">=": + return (actual >= compareTo) + case "<": + return (actual < compareTo) + case "<=": + return (actual <= compareTo) + } + return false +} + +func (matcher *BeNumericallyMatcher) matchUnsignedIntegers(actual, compareTo, threshold uint64) (success bool) { + switch matcher.Comparator { + case "==", "~": + if actual < compareTo { + actual, compareTo = compareTo, actual + } + return actual-compareTo <= threshold + case ">": + return (actual > compareTo) + case ">=": + return (actual >= compareTo) + case "<": + return (actual < compareTo) + case "<=": + return (actual <= compareTo) + } + return false +} + +func (matcher *BeNumericallyMatcher) matchFloats(actual, compareTo, threshold float64) (success bool) { + switch matcher.Comparator { + case "~": + return math.Abs(actual-compareTo) <= threshold + case "==": + return (actual == compareTo) + case ">": + return (actual > compareTo) + case ">=": + return (actual >= compareTo) + case "<": + return (actual < compareTo) + case "<=": + return (actual <= compareTo) + } + return false +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go new file mode 100644 index 0000000000..d7c32233ec --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go @@ -0,0 +1,71 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type BeSentMatcher struct { + Arg interface{} + channelClosed bool +} + +func (matcher *BeSentMatcher) Match(actual interface{}) (success bool, err error) { + if !isChan(actual) { + return false, fmt.Errorf("BeSent expects a channel. Got:\n%s", format.Object(actual, 1)) + } + + channelType := reflect.TypeOf(actual) + channelValue := reflect.ValueOf(actual) + + if channelType.ChanDir() == reflect.RecvDir { + return false, fmt.Errorf("BeSent matcher cannot be passed a receive-only channel. Got:\n%s", format.Object(actual, 1)) + } + + argType := reflect.TypeOf(matcher.Arg) + assignable := argType.AssignableTo(channelType.Elem()) + + if !assignable { + return false, fmt.Errorf("Cannot pass:\n%s to the channel:\n%s\nThe types don't match.", format.Object(matcher.Arg, 1), format.Object(actual, 1)) + } + + argValue := reflect.ValueOf(matcher.Arg) + + defer func() { + if e := recover(); e != nil { + success = false + err = fmt.Errorf("Cannot send to a closed channel") + matcher.channelClosed = true + } + }() + + winnerIndex, _, _ := reflect.Select([]reflect.SelectCase{ + reflect.SelectCase{Dir: reflect.SelectSend, Chan: channelValue, Send: argValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, + }) + + var didSend bool + if winnerIndex == 0 { + didSend = true + } + + return didSend, nil +} + +func (matcher *BeSentMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to send:", matcher.Arg) +} + +func (matcher *BeSentMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to send:", matcher.Arg) +} + +func (matcher *BeSentMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + if !isChan(actual) { + return false + } + + return !matcher.channelClosed +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go new file mode 100644 index 0000000000..abda4eb1e7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go @@ -0,0 +1,65 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "time" +) + +type BeTemporallyMatcher struct { + Comparator string + CompareTo time.Time + Threshold []time.Duration +} + +func (matcher *BeTemporallyMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo) +} + +func (matcher *BeTemporallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo) +} + +func (matcher *BeTemporallyMatcher) Match(actual interface{}) (bool, error) { + // predicate to test for time.Time type + isTime := func(t interface{}) bool { + _, ok := t.(time.Time) + return ok + } + + if !isTime(actual) { + return false, fmt.Errorf("Expected a time.Time. Got:\n%s", format.Object(actual, 1)) + } + + switch matcher.Comparator { + case "==", "~", ">", ">=", "<", "<=": + default: + return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator) + } + + var threshold = time.Millisecond + if len(matcher.Threshold) == 1 { + threshold = matcher.Threshold[0] + } + + return matcher.matchTimes(actual.(time.Time), matcher.CompareTo, threshold), nil +} + +func (matcher *BeTemporallyMatcher) matchTimes(actual, compareTo time.Time, threshold time.Duration) (success bool) { + switch matcher.Comparator { + case "==": + return actual.Equal(compareTo) + case "~": + diff := actual.Sub(compareTo) + return -threshold <= diff && diff <= threshold + case ">": + return actual.After(compareTo) + case ">=": + return !actual.Before(compareTo) + case "<": + return actual.Before(compareTo) + case "<=": + return !actual.After(compareTo) + } + return false +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go new file mode 100644 index 0000000000..1275e5fc9d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go @@ -0,0 +1,25 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type BeTrueMatcher struct { +} + +func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { + if !isBool(actual) { + return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) + } + + return actual.(bool), nil +} + +func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be true") +} + +func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be true") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go new file mode 100644 index 0000000000..b39c9144be --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go @@ -0,0 +1,27 @@ +package matchers + +import ( + "github.com/onsi/gomega/format" + "reflect" +) + +type BeZeroMatcher struct { +} + +func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil { + return true, nil + } + zeroValue := reflect.Zero(reflect.TypeOf(actual)).Interface() + + return reflect.DeepEqual(zeroValue, actual), nil + +} + +func (matcher *BeZeroMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be zero-valued") +} + +func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be zero-valued") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/consist_of.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/consist_of.go new file mode 100644 index 0000000000..7b0e088684 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/consist_of.go @@ -0,0 +1,80 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph" +) + +type ConsistOfMatcher struct { + Elements []interface{} +} + +func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err error) { + if !isArrayOrSlice(actual) && !isMap(actual) { + return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) + } + + elements := matcher.Elements + if len(matcher.Elements) == 1 && isArrayOrSlice(matcher.Elements[0]) { + elements = []interface{}{} + value := reflect.ValueOf(matcher.Elements[0]) + for i := 0; i < value.Len(); i++ { + elements = append(elements, value.Index(i).Interface()) + } + } + + matchers := []interface{}{} + for _, element := range elements { + matcher, isMatcher := element.(omegaMatcher) + if !isMatcher { + matcher = &EqualMatcher{Expected: element} + } + matchers = append(matchers, matcher) + } + + values := matcher.valuesOf(actual) + + if len(values) != len(matchers) { + return false, nil + } + + neighbours := func(v, m interface{}) (bool, error) { + match, err := m.(omegaMatcher).Match(v) + return match && err == nil, nil + } + + bipartiteGraph, err := bipartitegraph.NewBipartiteGraph(values, matchers, neighbours) + if err != nil { + return false, err + } + + return len(bipartiteGraph.LargestMatching()) == len(values), nil +} + +func (matcher *ConsistOfMatcher) valuesOf(actual interface{}) []interface{} { + value := reflect.ValueOf(actual) + values := []interface{}{} + if isMap(actual) { + keys := value.MapKeys() + for i := 0; i < value.Len(); i++ { + values = append(values, value.MapIndex(keys[i]).Interface()) + } + } else { + for i := 0; i < value.Len(); i++ { + values = append(values, value.Index(i).Interface()) + } + } + + return values +} + +func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to consist of", matcher.Elements) +} + +func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to consist of", matcher.Elements) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go new file mode 100644 index 0000000000..4159335d0d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go @@ -0,0 +1,56 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type ContainElementMatcher struct { + Element interface{} +} + +func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, err error) { + if !isArrayOrSlice(actual) && !isMap(actual) { + return false, fmt.Errorf("ContainElement matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) + } + + elemMatcher, elementIsMatcher := matcher.Element.(omegaMatcher) + if !elementIsMatcher { + elemMatcher = &EqualMatcher{Expected: matcher.Element} + } + + value := reflect.ValueOf(actual) + var keys []reflect.Value + if isMap(actual) { + keys = value.MapKeys() + } + var lastError error + for i := 0; i < value.Len(); i++ { + var success bool + var err error + if isMap(actual) { + success, err = elemMatcher.Match(value.MapIndex(keys[i]).Interface()) + } else { + success, err = elemMatcher.Match(value.Index(i).Interface()) + } + if err != nil { + lastError = err + continue + } + if success { + return true, nil + } + } + + return false, lastError +} + +func (matcher *ContainElementMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to contain element matching", matcher.Element) +} + +func (matcher *ContainElementMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to contain element matching", matcher.Element) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go new file mode 100644 index 0000000000..2e7608921a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go @@ -0,0 +1,37 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "strings" +) + +type ContainSubstringMatcher struct { + Substr string + Args []interface{} +} + +func (matcher *ContainSubstringMatcher) Match(actual interface{}) (success bool, err error) { + actualString, ok := toString(actual) + if !ok { + return false, fmt.Errorf("ContainSubstring matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) + } + + return strings.Contains(actualString, matcher.stringToMatch()), nil +} + +func (matcher *ContainSubstringMatcher) stringToMatch() string { + stringToMatch := matcher.Substr + if len(matcher.Args) > 0 { + stringToMatch = fmt.Sprintf(matcher.Substr, matcher.Args...) + } + return stringToMatch +} + +func (matcher *ContainSubstringMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to contain substring", matcher.stringToMatch()) +} + +func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to contain substring", matcher.stringToMatch()) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/equal_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/equal_matcher.go new file mode 100644 index 0000000000..874e6a6229 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/equal_matcher.go @@ -0,0 +1,33 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type EqualMatcher struct { + Expected interface{} +} + +func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil && matcher.Expected == nil { + return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") + } + return reflect.DeepEqual(actual, matcher.Expected), nil +} + +func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) { + actualString, actualOK := actual.(string) + expectedString, expectedOK := matcher.Expected.(string) + if actualOK && expectedOK { + return format.MessageWithDiff(actualString, "to equal", expectedString) + } + + return format.Message(actual, "to equal", matcher.Expected) +} + +func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to equal", matcher.Expected) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go new file mode 100644 index 0000000000..7ace93dc36 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go @@ -0,0 +1,28 @@ +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" +) + +type HaveCapMatcher struct { + Count int +} + +func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err error) { + length, ok := capOf(actual) + if !ok { + return false, fmt.Errorf("HaveCap matcher expects a array/channel/slice. Got:\n%s", format.Object(actual, 1)) + } + + return length == matcher.Count, nil +} + +func (matcher *HaveCapMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected\n%s\nto have capacity %d", format.Object(actual, 1), matcher.Count) +} + +func (matcher *HaveCapMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected\n%s\nnot to have capacity %d", format.Object(actual, 1), matcher.Count) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go new file mode 100644 index 0000000000..5701ba6e24 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go @@ -0,0 +1,53 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type HaveKeyMatcher struct { + Key interface{} +} + +func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err error) { + if !isMap(actual) { + return false, fmt.Errorf("HaveKey matcher expects a map. Got:%s", format.Object(actual, 1)) + } + + keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) + if !keyIsMatcher { + keyMatcher = &EqualMatcher{Expected: matcher.Key} + } + + keys := reflect.ValueOf(actual).MapKeys() + for i := 0; i < len(keys); i++ { + success, err := keyMatcher.Match(keys[i].Interface()) + if err != nil { + return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) + } + if success { + return true, nil + } + } + + return false, nil +} + +func (matcher *HaveKeyMatcher) FailureMessage(actual interface{}) (message string) { + switch matcher.Key.(type) { + case omegaMatcher: + return format.Message(actual, "to have key matching", matcher.Key) + default: + return format.Message(actual, "to have key", matcher.Key) + } +} + +func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual interface{}) (message string) { + switch matcher.Key.(type) { + case omegaMatcher: + return format.Message(actual, "not to have key matching", matcher.Key) + default: + return format.Message(actual, "not to have key", matcher.Key) + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go new file mode 100644 index 0000000000..464ac187e9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go @@ -0,0 +1,73 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type HaveKeyWithValueMatcher struct { + Key interface{} + Value interface{} +} + +func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, err error) { + if !isMap(actual) { + return false, fmt.Errorf("HaveKeyWithValue matcher expects a map. Got:%s", format.Object(actual, 1)) + } + + keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) + if !keyIsMatcher { + keyMatcher = &EqualMatcher{Expected: matcher.Key} + } + + valueMatcher, valueIsMatcher := matcher.Value.(omegaMatcher) + if !valueIsMatcher { + valueMatcher = &EqualMatcher{Expected: matcher.Value} + } + + keys := reflect.ValueOf(actual).MapKeys() + for i := 0; i < len(keys); i++ { + success, err := keyMatcher.Match(keys[i].Interface()) + if err != nil { + return false, fmt.Errorf("HaveKeyWithValue's key matcher failed with:\n%s%s", format.Indent, err.Error()) + } + if success { + actualValue := reflect.ValueOf(actual).MapIndex(keys[i]) + success, err := valueMatcher.Match(actualValue.Interface()) + if err != nil { + return false, fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error()) + } + return success, nil + } + } + + return false, nil +} + +func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual interface{}) (message string) { + str := "to have {key: value}" + if _, ok := matcher.Key.(omegaMatcher); ok { + str += " matching" + } else if _, ok := matcher.Value.(omegaMatcher); ok { + str += " matching" + } + + expect := make(map[interface{}]interface{}, 1) + expect[matcher.Key] = matcher.Value + return format.Message(actual, str, expect) +} + +func (matcher *HaveKeyWithValueMatcher) NegatedFailureMessage(actual interface{}) (message string) { + kStr := "not to have key" + if _, ok := matcher.Key.(omegaMatcher); ok { + kStr = "not to have key matching" + } + + vStr := "or that key's value not be" + if _, ok := matcher.Value.(omegaMatcher); ok { + vStr = "or to have that key's value not matching" + } + + return format.Message(actual, kStr, matcher.Key, vStr, matcher.Value) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go new file mode 100644 index 0000000000..a183775570 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go @@ -0,0 +1,27 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type HaveLenMatcher struct { + Count int +} + +func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) { + length, ok := lengthOf(actual) + if !ok { + return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) + } + + return length == matcher.Count, nil +} + +func (matcher *HaveLenMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected\n%s\nto have length %d", format.Object(actual, 1), matcher.Count) +} + +func (matcher *HaveLenMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected\n%s\nnot to have length %d", format.Object(actual, 1), matcher.Count) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go new file mode 100644 index 0000000000..ebdd71786d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go @@ -0,0 +1,33 @@ +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" +) + +type HaveOccurredMatcher struct { +} + +func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) { + // is purely nil? + if actual == nil { + return false, nil + } + + // must be an 'error' type + if !isError(actual) { + return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) + } + + // must be non-nil (or a pointer to a non-nil) + return !isNil(actual), nil +} + +func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1)) +} + +func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred") +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go new file mode 100644 index 0000000000..8b63a89997 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go @@ -0,0 +1,35 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type HavePrefixMatcher struct { + Prefix string + Args []interface{} +} + +func (matcher *HavePrefixMatcher) Match(actual interface{}) (success bool, err error) { + actualString, ok := toString(actual) + if !ok { + return false, fmt.Errorf("HavePrefix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) + } + prefix := matcher.prefix() + return len(actualString) >= len(prefix) && actualString[0:len(prefix)] == prefix, nil +} + +func (matcher *HavePrefixMatcher) prefix() string { + if len(matcher.Args) > 0 { + return fmt.Sprintf(matcher.Prefix, matcher.Args...) + } + return matcher.Prefix +} + +func (matcher *HavePrefixMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to have prefix", matcher.prefix()) +} + +func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to have prefix", matcher.prefix()) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go new file mode 100644 index 0000000000..afc78fc901 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go @@ -0,0 +1,35 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type HaveSuffixMatcher struct { + Suffix string + Args []interface{} +} + +func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) { + actualString, ok := toString(actual) + if !ok { + return false, fmt.Errorf("HaveSuffix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) + } + suffix := matcher.suffix() + return len(actualString) >= len(suffix) && actualString[len(actualString)-len(suffix):] == suffix, nil +} + +func (matcher *HaveSuffixMatcher) suffix() string { + if len(matcher.Args) > 0 { + return fmt.Sprintf(matcher.Suffix, matcher.Args...) + } + return matcher.Suffix +} + +func (matcher *HaveSuffixMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to have suffix", matcher.suffix()) +} + +func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to have suffix", matcher.suffix()) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go new file mode 100644 index 0000000000..03cdf04588 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go @@ -0,0 +1,50 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type MatchErrorMatcher struct { + Expected interface{} +} + +func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) { + if isNil(actual) { + return false, fmt.Errorf("Expected an error, got nil") + } + + if !isError(actual) { + return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) + } + + actualErr := actual.(error) + + if isString(matcher.Expected) { + return reflect.DeepEqual(actualErr.Error(), matcher.Expected), nil + } + + if isError(matcher.Expected) { + return reflect.DeepEqual(actualErr, matcher.Expected), nil + } + + var subMatcher omegaMatcher + var hasSubMatcher bool + if matcher.Expected != nil { + subMatcher, hasSubMatcher = (matcher.Expected).(omegaMatcher) + if hasSubMatcher { + return subMatcher.Match(actualErr.Error()) + } + } + + return false, fmt.Errorf("MatchError must be passed an error, string, or Matcher that can match on strings. Got:\n%s", format.Object(matcher.Expected, 1)) +} + +func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to match error", matcher.Expected) +} + +func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match error", matcher.Expected) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go new file mode 100644 index 0000000000..499bb58301 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go @@ -0,0 +1,135 @@ +package matchers + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/onsi/gomega/format" +) + +type MatchJSONMatcher struct { + JSONToMatch interface{} + firstFailurePath []interface{} +} + +func (matcher *MatchJSONMatcher) Match(actual interface{}) (success bool, err error) { + actualString, expectedString, err := matcher.prettyPrint(actual) + if err != nil { + return false, err + } + + var aval interface{} + var eval interface{} + + // this is guarded by prettyPrint + json.Unmarshal([]byte(actualString), &aval) + json.Unmarshal([]byte(expectedString), &eval) + var equal bool + equal, matcher.firstFailurePath = deepEqual(aval, eval) + return equal, nil +} + +func (matcher *MatchJSONMatcher) FailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.prettyPrint(actual) + return formattedMessage(format.Message(actualString, "to match JSON of", expectedString), matcher.firstFailurePath) +} + +func (matcher *MatchJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.prettyPrint(actual) + return formattedMessage(format.Message(actualString, "not to match JSON of", expectedString), matcher.firstFailurePath) +} + +func formattedMessage(comparisonMessage string, failurePath []interface{}) string { + var diffMessage string + if len(failurePath) == 0 { + diffMessage = "" + } else { + diffMessage = fmt.Sprintf("\n\nfirst mismatched key: %s", formattedFailurePath(failurePath)) + } + return fmt.Sprintf("%s%s", comparisonMessage, diffMessage) +} + +func formattedFailurePath(failurePath []interface{}) string { + formattedPaths := []string{} + for i := len(failurePath) - 1; i >= 0; i-- { + switch p := failurePath[i].(type) { + case int: + formattedPaths = append(formattedPaths, fmt.Sprintf(`[%d]`, p)) + default: + if i != len(failurePath)-1 { + formattedPaths = append(formattedPaths, ".") + } + formattedPaths = append(formattedPaths, fmt.Sprintf(`"%s"`, p)) + } + } + return strings.Join(formattedPaths, "") +} + +func (matcher *MatchJSONMatcher) prettyPrint(actual interface{}) (actualFormatted, expectedFormatted string, err error) { + actualString, ok := toString(actual) + if !ok { + return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) + } + expectedString, ok := toString(matcher.JSONToMatch) + if !ok { + return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.JSONToMatch, 1)) + } + + abuf := new(bytes.Buffer) + ebuf := new(bytes.Buffer) + + if err := json.Indent(abuf, []byte(actualString), "", " "); err != nil { + return "", "", fmt.Errorf("Actual '%s' should be valid JSON, but it is not.\nUnderlying error:%s", actualString, err) + } + + if err := json.Indent(ebuf, []byte(expectedString), "", " "); err != nil { + return "", "", fmt.Errorf("Expected '%s' should be valid JSON, but it is not.\nUnderlying error:%s", expectedString, err) + } + + return abuf.String(), ebuf.String(), nil +} + +func deepEqual(a interface{}, b interface{}) (bool, []interface{}) { + var errorPath []interface{} + if reflect.TypeOf(a) != reflect.TypeOf(b) { + return false, errorPath + } + + switch a.(type) { + case []interface{}: + if len(a.([]interface{})) != len(b.([]interface{})) { + return false, errorPath + } + + for i, v := range a.([]interface{}) { + elementEqual, keyPath := deepEqual(v, b.([]interface{})[i]) + if !elementEqual { + return false, append(keyPath, i) + } + } + return true, errorPath + + case map[string]interface{}: + if len(a.(map[string]interface{})) != len(b.(map[string]interface{})) { + return false, errorPath + } + + for k, v1 := range a.(map[string]interface{}) { + v2, ok := b.(map[string]interface{})[k] + if !ok { + return false, errorPath + } + elementEqual, keyPath := deepEqual(v1, v2) + if !elementEqual { + return false, append(keyPath, k) + } + } + return true, errorPath + + default: + return a == b, errorPath + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go new file mode 100644 index 0000000000..7ca79a15be --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go @@ -0,0 +1,42 @@ +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "regexp" +) + +type MatchRegexpMatcher struct { + Regexp string + Args []interface{} +} + +func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) { + actualString, ok := toString(actual) + if !ok { + return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1)) + } + + match, err := regexp.Match(matcher.regexp(), []byte(actualString)) + if err != nil { + return false, fmt.Errorf("RegExp match failed to compile with error:\n\t%s", err.Error()) + } + + return match, nil +} + +func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to match regular expression", matcher.regexp()) +} + +func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match regular expression", matcher.regexp()) +} + +func (matcher *MatchRegexpMatcher) regexp() string { + re := matcher.Regexp + if len(matcher.Args) > 0 { + re = fmt.Sprintf(matcher.Regexp, matcher.Args...) + } + return re +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go new file mode 100644 index 0000000000..da26562902 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go @@ -0,0 +1,131 @@ +package matchers + +import ( + "bytes" + "encoding/xml" + "errors" + "fmt" + "io" + "reflect" + "strings" + + "github.com/onsi/gomega/format" + "golang.org/x/net/html/charset" +) + +type MatchXMLMatcher struct { + XMLToMatch interface{} +} + +func (matcher *MatchXMLMatcher) Match(actual interface{}) (success bool, err error) { + actualString, expectedString, err := matcher.formattedPrint(actual) + if err != nil { + return false, err + } + + aval, err := parseXmlContent(actualString) + if err != nil { + return false, fmt.Errorf("Actual '%s' should be valid XML, but it is not.\nUnderlying error:%s", actualString, err) + } + + eval, err := parseXmlContent(expectedString) + if err != nil { + return false, fmt.Errorf("Expected '%s' should be valid XML, but it is not.\nUnderlying error:%s", expectedString, err) + } + + return reflect.DeepEqual(aval, eval), nil +} + +func (matcher *MatchXMLMatcher) FailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.formattedPrint(actual) + return fmt.Sprintf("Expected\n%s\nto match XML of\n%s", actualString, expectedString) +} + +func (matcher *MatchXMLMatcher) NegatedFailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.formattedPrint(actual) + return fmt.Sprintf("Expected\n%s\nnot to match XML of\n%s", actualString, expectedString) +} + +func (matcher *MatchXMLMatcher) formattedPrint(actual interface{}) (actualString, expectedString string, err error) { + var ok bool + actualString, ok = toString(actual) + if !ok { + return "", "", fmt.Errorf("MatchXMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) + } + expectedString, ok = toString(matcher.XMLToMatch) + if !ok { + return "", "", fmt.Errorf("MatchXMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.XMLToMatch, 1)) + } + return actualString, expectedString, nil +} + +func parseXmlContent(content string) (*xmlNode, error) { + allNodes := []*xmlNode{} + + dec := newXmlDecoder(strings.NewReader(content)) + for { + tok, err := dec.Token() + if err != nil { + if err == io.EOF { + break + } + return nil, fmt.Errorf("failed to decode next token: %v", err) + } + + lastNodeIndex := len(allNodes) - 1 + var lastNode *xmlNode + if len(allNodes) > 0 { + lastNode = allNodes[lastNodeIndex] + } else { + lastNode = &xmlNode{} + } + + switch tok := tok.(type) { + case xml.StartElement: + allNodes = append(allNodes, &xmlNode{XMLName: tok.Name, XMLAttr: tok.Attr}) + case xml.EndElement: + if len(allNodes) > 1 { + allNodes[lastNodeIndex-1].Nodes = append(allNodes[lastNodeIndex-1].Nodes, lastNode) + allNodes = allNodes[:lastNodeIndex] + } + case xml.CharData: + lastNode.Content = append(lastNode.Content, tok.Copy()...) + case xml.Comment: + lastNode.Comments = append(lastNode.Comments, tok.Copy()) + case xml.ProcInst: + lastNode.ProcInsts = append(lastNode.ProcInsts, tok.Copy()) + } + } + + if len(allNodes) == 0 { + return nil, errors.New("found no nodes") + } + firstNode := allNodes[0] + trimParentNodesContentSpaces(firstNode) + + return firstNode, nil +} + +func newXmlDecoder(reader io.Reader) *xml.Decoder { + dec := xml.NewDecoder(reader) + dec.CharsetReader = charset.NewReaderLabel + return dec +} + +func trimParentNodesContentSpaces(node *xmlNode) { + if len(node.Nodes) > 0 { + node.Content = bytes.TrimSpace(node.Content) + for _, childNode := range node.Nodes { + trimParentNodesContentSpaces(childNode) + } + } +} + +type xmlNode struct { + XMLName xml.Name + Comments []xml.Comment + ProcInsts []xml.ProcInst + XMLAttr []xml.Attr + Content []byte + Nodes []*xmlNode +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go new file mode 100644 index 0000000000..69fb51a859 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go @@ -0,0 +1,74 @@ +package matchers + +import ( + "fmt" + "reflect" + "strings" + + "github.com/onsi/gomega/format" + "gopkg.in/yaml.v2" +) + +type MatchYAMLMatcher struct { + YAMLToMatch interface{} +} + +func (matcher *MatchYAMLMatcher) Match(actual interface{}) (success bool, err error) { + actualString, expectedString, err := matcher.toStrings(actual) + if err != nil { + return false, err + } + + var aval interface{} + var eval interface{} + + if err := yaml.Unmarshal([]byte(actualString), &aval); err != nil { + return false, fmt.Errorf("Actual '%s' should be valid YAML, but it is not.\nUnderlying error:%s", actualString, err) + } + if err := yaml.Unmarshal([]byte(expectedString), &eval); err != nil { + return false, fmt.Errorf("Expected '%s' should be valid YAML, but it is not.\nUnderlying error:%s", expectedString, err) + } + + return reflect.DeepEqual(aval, eval), nil +} + +func (matcher *MatchYAMLMatcher) FailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.toNormalisedStrings(actual) + return format.Message(actualString, "to match YAML of", expectedString) +} + +func (matcher *MatchYAMLMatcher) NegatedFailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.toNormalisedStrings(actual) + return format.Message(actualString, "not to match YAML of", expectedString) +} + +func (matcher *MatchYAMLMatcher) toNormalisedStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) { + actualString, expectedString, err := matcher.toStrings(actual) + return normalise(actualString), normalise(expectedString), err +} + +func normalise(input string) string { + var val interface{} + err := yaml.Unmarshal([]byte(input), &val) + if err != nil { + panic(err) // guarded by Match + } + output, err := yaml.Marshal(val) + if err != nil { + panic(err) // guarded by Unmarshal + } + return strings.TrimSpace(string(output)) +} + +func (matcher *MatchYAMLMatcher) toStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) { + actualString, ok := toString(actual) + if !ok { + return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) + } + expectedString, ok := toString(matcher.YAMLToMatch) + if !ok { + return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.YAMLToMatch, 1)) + } + + return actualString, expectedString, nil +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/not.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/not.go new file mode 100644 index 0000000000..2c91670bd9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/not.go @@ -0,0 +1,30 @@ +package matchers + +import ( + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type NotMatcher struct { + Matcher types.GomegaMatcher +} + +func (m *NotMatcher) Match(actual interface{}) (bool, error) { + success, err := m.Matcher.Match(actual) + if err != nil { + return false, err + } + return !success, nil +} + +func (m *NotMatcher) FailureMessage(actual interface{}) (message string) { + return m.Matcher.NegatedFailureMessage(actual) // works beautifully +} + +func (m *NotMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return m.Matcher.FailureMessage(actual) // works beautifully +} + +func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/or.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/or.go new file mode 100644 index 0000000000..3bf7998001 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/or.go @@ -0,0 +1,67 @@ +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type OrMatcher struct { + Matchers []types.GomegaMatcher + + // state + firstSuccessfulMatcher types.GomegaMatcher +} + +func (m *OrMatcher) Match(actual interface{}) (success bool, err error) { + m.firstSuccessfulMatcher = nil + for _, matcher := range m.Matchers { + success, err := matcher.Match(actual) + if err != nil { + return false, err + } + if success { + m.firstSuccessfulMatcher = matcher + return true, nil + } + } + return false, nil +} + +func (m *OrMatcher) FailureMessage(actual interface{}) (message string) { + // not the most beautiful list of matchers, but not bad either... + return format.Message(actual, fmt.Sprintf("To satisfy at least one of these matchers: %s", m.Matchers)) +} + +func (m *OrMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return m.firstSuccessfulMatcher.NegatedFailureMessage(actual) +} + +func (m *OrMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + /* + Example with 3 matchers: A, B, C + + Match evaluates them: F, T, => T + So match is currently T, what should MatchMayChangeInTheFuture() return? + Seems like it only depends on B, since currently B MUST change to allow the result to become F + + Match eval: F, F, F => F + So match is currently F, what should MatchMayChangeInTheFuture() return? + Seems to depend on ANY of them being able to change to T. + */ + + if m.firstSuccessfulMatcher != nil { + // one of the matchers succeeded.. it must be able to change in order to affect the result + return oraclematcher.MatchMayChangeInTheFuture(m.firstSuccessfulMatcher, actual) + } else { + // so all matchers failed.. Any one of them changing would change the result. + for _, matcher := range m.Matchers { + if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) { + return true + } + } + return false // none of were going to change + } +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/panic_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/panic_matcher.go new file mode 100644 index 0000000000..640f4db1a3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/panic_matcher.go @@ -0,0 +1,46 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type PanicMatcher struct { + object interface{} +} + +func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil { + return false, fmt.Errorf("PanicMatcher expects a non-nil actual.") + } + + actualType := reflect.TypeOf(actual) + if actualType.Kind() != reflect.Func { + return false, fmt.Errorf("PanicMatcher expects a function. Got:\n%s", format.Object(actual, 1)) + } + if !(actualType.NumIn() == 0 && actualType.NumOut() == 0) { + return false, fmt.Errorf("PanicMatcher expects a function with no arguments and no return value. Got:\n%s", format.Object(actual, 1)) + } + + success = false + defer func() { + if e := recover(); e != nil { + matcher.object = e + success = true + } + }() + + reflect.ValueOf(actual).Call([]reflect.Value{}) + + return +} + +func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to panic") +} + +func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1))) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/receive_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/receive_matcher.go new file mode 100644 index 0000000000..74e9e7ebe1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/receive_matcher.go @@ -0,0 +1,122 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type ReceiveMatcher struct { + Arg interface{} + receivedValue reflect.Value + channelClosed bool +} + +func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err error) { + if !isChan(actual) { + return false, fmt.Errorf("ReceiveMatcher expects a channel. Got:\n%s", format.Object(actual, 1)) + } + + channelType := reflect.TypeOf(actual) + channelValue := reflect.ValueOf(actual) + + if channelType.ChanDir() == reflect.SendDir { + return false, fmt.Errorf("ReceiveMatcher matcher cannot be passed a send-only channel. Got:\n%s", format.Object(actual, 1)) + } + + var subMatcher omegaMatcher + var hasSubMatcher bool + + if matcher.Arg != nil { + subMatcher, hasSubMatcher = (matcher.Arg).(omegaMatcher) + if !hasSubMatcher { + argType := reflect.TypeOf(matcher.Arg) + if argType.Kind() != reflect.Ptr { + return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s\nYou need to pass a pointer!", format.Object(actual, 1), format.Object(matcher.Arg, 1)) + } + + assignable := channelType.Elem().AssignableTo(argType.Elem()) + if !assignable { + return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s", format.Object(actual, 1), format.Object(matcher.Arg, 1)) + } + } + } + + winnerIndex, value, open := reflect.Select([]reflect.SelectCase{ + reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, + }) + + var closed bool + var didReceive bool + if winnerIndex == 0 { + closed = !open + didReceive = open + } + matcher.channelClosed = closed + + if closed { + return false, nil + } + + if hasSubMatcher { + if didReceive { + matcher.receivedValue = value + return subMatcher.Match(matcher.receivedValue.Interface()) + } + return false, nil + } + + if didReceive { + if matcher.Arg != nil { + outValue := reflect.ValueOf(matcher.Arg) + reflect.Indirect(outValue).Set(value) + } + + return true, nil + } + return false, nil +} + +func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message string) { + subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) + + closedAddendum := "" + if matcher.channelClosed { + closedAddendum = " The channel is closed." + } + + if hasSubMatcher { + if matcher.receivedValue.IsValid() { + return subMatcher.FailureMessage(matcher.receivedValue.Interface()) + } + return "When passed a matcher, ReceiveMatcher's channel *must* receive something." + } + return format.Message(actual, "to receive something."+closedAddendum) +} + +func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (message string) { + subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) + + closedAddendum := "" + if matcher.channelClosed { + closedAddendum = " The channel is closed." + } + + if hasSubMatcher { + if matcher.receivedValue.IsValid() { + return subMatcher.NegatedFailureMessage(matcher.receivedValue.Interface()) + } + return "When passed a matcher, ReceiveMatcher's channel *must* receive something." + } + return format.Message(actual, "not to receive anything."+closedAddendum) +} + +func (matcher *ReceiveMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + if !isChan(actual) { + return false + } + + return !matcher.channelClosed +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go new file mode 100644 index 0000000000..721ed5529b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go @@ -0,0 +1,33 @@ +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" +) + +type SucceedMatcher struct { +} + +func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err error) { + // is purely nil? + if actual == nil { + return true, nil + } + + // must be an 'error' type + if !isError(actual) { + return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) + } + + // must be nil (or a pointer to a nil) + return isNil(actual), nil +} + +func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1)) +} + +func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return "Expected failure, but got no error." +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go new file mode 100644 index 0000000000..119d21ef31 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go @@ -0,0 +1,41 @@ +package bipartitegraph + +import "errors" +import "fmt" + +import . "github.com/onsi/gomega/matchers/support/goraph/node" +import . "github.com/onsi/gomega/matchers/support/goraph/edge" + +type BipartiteGraph struct { + Left NodeOrderedSet + Right NodeOrderedSet + Edges EdgeSet +} + +func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) { + left := NodeOrderedSet{} + for i, _ := range leftValues { + left = append(left, Node{i}) + } + + right := NodeOrderedSet{} + for j, _ := range rightValues { + right = append(right, Node{j + len(left)}) + } + + edges := EdgeSet{} + for i, leftValue := range leftValues { + for j, rightValue := range rightValues { + neighbours, err := neighbours(leftValue, rightValue) + if err != nil { + return nil, errors.New(fmt.Sprintf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error())) + } + + if neighbours { + edges = append(edges, Edge{left[i], right[j]}) + } + } + } + + return &BipartiteGraph{left, right, edges}, nil +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go new file mode 100644 index 0000000000..8181f43a40 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go @@ -0,0 +1,159 @@ +package bipartitegraph + +import . "github.com/onsi/gomega/matchers/support/goraph/node" +import . "github.com/onsi/gomega/matchers/support/goraph/edge" +import "github.com/onsi/gomega/matchers/support/goraph/util" + +func (bg *BipartiteGraph) LargestMatching() (matching EdgeSet) { + paths := bg.maximalDisjointSLAPCollection(matching) + + for len(paths) > 0 { + for _, path := range paths { + matching = matching.SymmetricDifference(path) + } + paths = bg.maximalDisjointSLAPCollection(matching) + } + + return +} + +func (bg *BipartiteGraph) maximalDisjointSLAPCollection(matching EdgeSet) (result []EdgeSet) { + guideLayers := bg.createSLAPGuideLayers(matching) + if len(guideLayers) == 0 { + return + } + + used := make(map[Node]bool) + + for _, u := range guideLayers[len(guideLayers)-1] { + slap, found := bg.findDisjointSLAP(u, matching, guideLayers, used) + if found { + for _, edge := range slap { + used[edge.Node1] = true + used[edge.Node2] = true + } + result = append(result, slap) + } + } + + return +} + +func (bg *BipartiteGraph) findDisjointSLAP( + start Node, + matching EdgeSet, + guideLayers []NodeOrderedSet, + used map[Node]bool, +) ([]Edge, bool) { + return bg.findDisjointSLAPHelper(start, EdgeSet{}, len(guideLayers)-1, matching, guideLayers, used) +} + +func (bg *BipartiteGraph) findDisjointSLAPHelper( + currentNode Node, + currentSLAP EdgeSet, + currentLevel int, + matching EdgeSet, + guideLayers []NodeOrderedSet, + used map[Node]bool, +) (EdgeSet, bool) { + used[currentNode] = true + + if currentLevel == 0 { + return currentSLAP, true + } + + for _, nextNode := range guideLayers[currentLevel-1] { + if used[nextNode] { + continue + } + + edge, found := bg.Edges.FindByNodes(currentNode, nextNode) + if !found { + continue + } + + if matching.Contains(edge) == util.Odd(currentLevel) { + continue + } + + currentSLAP = append(currentSLAP, edge) + slap, found := bg.findDisjointSLAPHelper(nextNode, currentSLAP, currentLevel-1, matching, guideLayers, used) + if found { + return slap, true + } + currentSLAP = currentSLAP[:len(currentSLAP)-1] + } + + used[currentNode] = false + return nil, false +} + +func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers []NodeOrderedSet) { + used := make(map[Node]bool) + currentLayer := NodeOrderedSet{} + + for _, node := range bg.Left { + if matching.Free(node) { + used[node] = true + currentLayer = append(currentLayer, node) + } + } + + if len(currentLayer) == 0 { + return []NodeOrderedSet{} + } + guideLayers = append(guideLayers, currentLayer) + + done := false + + for !done { + lastLayer := currentLayer + currentLayer = NodeOrderedSet{} + + if util.Odd(len(guideLayers)) { + for _, leftNode := range lastLayer { + for _, rightNode := range bg.Right { + if used[rightNode] { + continue + } + + edge, found := bg.Edges.FindByNodes(leftNode, rightNode) + if !found || matching.Contains(edge) { + continue + } + + currentLayer = append(currentLayer, rightNode) + used[rightNode] = true + + if matching.Free(rightNode) { + done = true + } + } + } + } else { + for _, rightNode := range lastLayer { + for _, leftNode := range bg.Left { + if used[leftNode] { + continue + } + + edge, found := bg.Edges.FindByNodes(leftNode, rightNode) + if !found || !matching.Contains(edge) { + continue + } + + currentLayer = append(currentLayer, leftNode) + used[leftNode] = true + } + } + + } + + if len(currentLayer) == 0 { + return []NodeOrderedSet{} + } + guideLayers = append(guideLayers, currentLayer) + } + + return +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go new file mode 100644 index 0000000000..4fd15cc069 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go @@ -0,0 +1,61 @@ +package edge + +import . "github.com/onsi/gomega/matchers/support/goraph/node" + +type Edge struct { + Node1 Node + Node2 Node +} + +type EdgeSet []Edge + +func (ec EdgeSet) Free(node Node) bool { + for _, e := range ec { + if e.Node1 == node || e.Node2 == node { + return false + } + } + + return true +} + +func (ec EdgeSet) Contains(edge Edge) bool { + for _, e := range ec { + if e == edge { + return true + } + } + + return false +} + +func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) { + for _, e := range ec { + if (e.Node1 == node1 && e.Node2 == node2) || (e.Node1 == node2 && e.Node2 == node1) { + return e, true + } + } + + return Edge{}, false +} + +func (ec EdgeSet) SymmetricDifference(ec2 EdgeSet) EdgeSet { + edgesToInclude := make(map[Edge]bool) + + for _, e := range ec { + edgesToInclude[e] = true + } + + for _, e := range ec2 { + edgesToInclude[e] = !edgesToInclude[e] + } + + result := EdgeSet{} + for e, include := range edgesToInclude { + if include { + result = append(result, e) + } + } + + return result +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go new file mode 100644 index 0000000000..800c2ea8ca --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go @@ -0,0 +1,7 @@ +package node + +type Node struct { + Id int +} + +type NodeOrderedSet []Node diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go new file mode 100644 index 0000000000..d76a1ee00a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go @@ -0,0 +1,7 @@ +package util + +import "math" + +func Odd(n int) bool { + return math.Mod(float64(n), 2.0) == 1.0 +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/type_support.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/type_support.go new file mode 100644 index 0000000000..b05a5e75d4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/type_support.go @@ -0,0 +1,173 @@ +/* +Gomega matchers + +This package implements the Gomega matchers and does not typically need to be imported. +See the docs for Gomega for documentation on the matchers + +http://onsi.github.io/gomega/ +*/ +package matchers + +import ( + "fmt" + "reflect" +) + +type omegaMatcher interface { + Match(actual interface{}) (success bool, err error) + FailureMessage(actual interface{}) (message string) + NegatedFailureMessage(actual interface{}) (message string) +} + +func isBool(a interface{}) bool { + return reflect.TypeOf(a).Kind() == reflect.Bool +} + +func isNumber(a interface{}) bool { + if a == nil { + return false + } + kind := reflect.TypeOf(a).Kind() + return reflect.Int <= kind && kind <= reflect.Float64 +} + +func isInteger(a interface{}) bool { + kind := reflect.TypeOf(a).Kind() + return reflect.Int <= kind && kind <= reflect.Int64 +} + +func isUnsignedInteger(a interface{}) bool { + kind := reflect.TypeOf(a).Kind() + return reflect.Uint <= kind && kind <= reflect.Uint64 +} + +func isFloat(a interface{}) bool { + kind := reflect.TypeOf(a).Kind() + return reflect.Float32 <= kind && kind <= reflect.Float64 +} + +func toInteger(a interface{}) int64 { + if isInteger(a) { + return reflect.ValueOf(a).Int() + } else if isUnsignedInteger(a) { + return int64(reflect.ValueOf(a).Uint()) + } else if isFloat(a) { + return int64(reflect.ValueOf(a).Float()) + } + panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) +} + +func toUnsignedInteger(a interface{}) uint64 { + if isInteger(a) { + return uint64(reflect.ValueOf(a).Int()) + } else if isUnsignedInteger(a) { + return reflect.ValueOf(a).Uint() + } else if isFloat(a) { + return uint64(reflect.ValueOf(a).Float()) + } + panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) +} + +func toFloat(a interface{}) float64 { + if isInteger(a) { + return float64(reflect.ValueOf(a).Int()) + } else if isUnsignedInteger(a) { + return float64(reflect.ValueOf(a).Uint()) + } else if isFloat(a) { + return reflect.ValueOf(a).Float() + } + panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) +} + +func isError(a interface{}) bool { + _, ok := a.(error) + return ok +} + +func isChan(a interface{}) bool { + if isNil(a) { + return false + } + return reflect.TypeOf(a).Kind() == reflect.Chan +} + +func isMap(a interface{}) bool { + if a == nil { + return false + } + return reflect.TypeOf(a).Kind() == reflect.Map +} + +func isArrayOrSlice(a interface{}) bool { + if a == nil { + return false + } + switch reflect.TypeOf(a).Kind() { + case reflect.Array, reflect.Slice: + return true + default: + return false + } +} + +func isString(a interface{}) bool { + if a == nil { + return false + } + return reflect.TypeOf(a).Kind() == reflect.String +} + +func toString(a interface{}) (string, bool) { + aString, isString := a.(string) + if isString { + return aString, true + } + + aBytes, isBytes := a.([]byte) + if isBytes { + return string(aBytes), true + } + + aStringer, isStringer := a.(fmt.Stringer) + if isStringer { + return aStringer.String(), true + } + + return "", false +} + +func lengthOf(a interface{}) (int, bool) { + if a == nil { + return 0, false + } + switch reflect.TypeOf(a).Kind() { + case reflect.Map, reflect.Array, reflect.String, reflect.Chan, reflect.Slice: + return reflect.ValueOf(a).Len(), true + default: + return 0, false + } +} +func capOf(a interface{}) (int, bool) { + if a == nil { + return 0, false + } + switch reflect.TypeOf(a).Kind() { + case reflect.Array, reflect.Chan, reflect.Slice: + return reflect.ValueOf(a).Cap(), true + default: + return 0, false + } +} + +func isNil(a interface{}) bool { + if a == nil { + return true + } + + switch reflect.TypeOf(a).Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return reflect.ValueOf(a).IsNil() + } + + return false +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/with_transform.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/with_transform.go new file mode 100644 index 0000000000..8e58d8a0fb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/matchers/with_transform.go @@ -0,0 +1,72 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type WithTransformMatcher struct { + // input + Transform interface{} // must be a function of one parameter that returns one value + Matcher types.GomegaMatcher + + // cached value + transformArgType reflect.Type + + // state + transformedValue interface{} +} + +func NewWithTransformMatcher(transform interface{}, matcher types.GomegaMatcher) *WithTransformMatcher { + if transform == nil { + panic("transform function cannot be nil") + } + txType := reflect.TypeOf(transform) + if txType.NumIn() != 1 { + panic("transform function must have 1 argument") + } + if txType.NumOut() != 1 { + panic("transform function must have 1 return value") + } + + return &WithTransformMatcher{ + Transform: transform, + Matcher: matcher, + transformArgType: reflect.TypeOf(transform).In(0), + } +} + +func (m *WithTransformMatcher) Match(actual interface{}) (bool, error) { + // return error if actual's type is incompatible with Transform function's argument type + actualType := reflect.TypeOf(actual) + if !actualType.AssignableTo(m.transformArgType) { + return false, fmt.Errorf("Transform function expects '%s' but we have '%s'", m.transformArgType, actualType) + } + + // call the Transform function with `actual` + fn := reflect.ValueOf(m.Transform) + result := fn.Call([]reflect.Value{reflect.ValueOf(actual)}) + m.transformedValue = result[0].Interface() // expect exactly one value + + return m.Matcher.Match(m.transformedValue) +} + +func (m *WithTransformMatcher) FailureMessage(_ interface{}) (message string) { + return m.Matcher.FailureMessage(m.transformedValue) +} + +func (m *WithTransformMatcher) NegatedFailureMessage(_ interface{}) (message string) { + return m.Matcher.NegatedFailureMessage(m.transformedValue) +} + +func (m *WithTransformMatcher) MatchMayChangeInTheFuture(_ interface{}) bool { + // TODO: Maybe this should always just return true? (Only an issue for non-deterministic transformers.) + // + // Querying the next matcher is fine if the transformer always will return the same value. + // But if the transformer is non-deterministic and returns a different value each time, then there + // is no point in querying the next matcher, since it can only comment on the last transformed value. + return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, m.transformedValue) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/types/types.go b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/types/types.go new file mode 100644 index 0000000000..a83b40110c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/github.com/onsi/gomega/types/types.go @@ -0,0 +1,17 @@ +package types + +type GomegaFailHandler func(message string, callerSkip ...int) + +//A simple *testing.T interface wrapper +type GomegaTestingT interface { + Fatalf(format string, args ...interface{}) +} + +//All Gomega matchers must implement the GomegaMatcher interface +// +//For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding_your_own_matchers +type GomegaMatcher interface { + Match(actual interface{}) (success bool, err error) + FailureMessage(actual interface{}) (message string) + NegatedFailureMessage(actual interface{}) (message string) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/LICENSE b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/LICENSE new file mode 100644 index 0000000000..6a66aea5ea --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/PATENTS b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/atom/atom.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/atom/atom.go new file mode 100644 index 0000000000..cd0a8ac154 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/atom/atom.go @@ -0,0 +1,78 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package atom provides integer codes (also known as atoms) for a fixed set of +// frequently occurring HTML strings: tag names and attribute keys such as "p" +// and "id". +// +// Sharing an atom's name between all elements with the same tag can result in +// fewer string allocations when tokenizing and parsing HTML. Integer +// comparisons are also generally faster than string comparisons. +// +// The value of an atom's particular code is not guaranteed to stay the same +// between versions of this package. Neither is any ordering guaranteed: +// whether atom.H1 < atom.H2 may also change. The codes are not guaranteed to +// be dense. The only guarantees are that e.g. looking up "div" will yield +// atom.Div, calling atom.Div.String will return "div", and atom.Div != 0. +package atom // import "golang.org/x/net/html/atom" + +// Atom is an integer code for a string. The zero value maps to "". +type Atom uint32 + +// String returns the atom's name. +func (a Atom) String() string { + start := uint32(a >> 8) + n := uint32(a & 0xff) + if start+n > uint32(len(atomText)) { + return "" + } + return atomText[start : start+n] +} + +func (a Atom) string() string { + return atomText[a>>8 : a>>8+a&0xff] +} + +// fnv computes the FNV hash with an arbitrary starting value h. +func fnv(h uint32, s []byte) uint32 { + for i := range s { + h ^= uint32(s[i]) + h *= 16777619 + } + return h +} + +func match(s string, t []byte) bool { + for i, c := range t { + if s[i] != c { + return false + } + } + return true +} + +// Lookup returns the atom whose name is s. It returns zero if there is no +// such atom. The lookup is case sensitive. +func Lookup(s []byte) Atom { + if len(s) == 0 || len(s) > maxAtomLen { + return 0 + } + h := fnv(hash0, s) + if a := table[h&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) { + return a + } + if a := table[(h>>16)&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) { + return a + } + return 0 +} + +// String returns a string whose contents are equal to s. In that sense, it is +// equivalent to string(s) but may be more efficient. +func String(s []byte) string { + if a := Lookup(s); a != 0 { + return a.String() + } + return string(s) +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/atom/table.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/atom/table.go new file mode 100644 index 0000000000..2605ba3102 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/atom/table.go @@ -0,0 +1,713 @@ +// generated by go run gen.go; DO NOT EDIT + +package atom + +const ( + A Atom = 0x1 + Abbr Atom = 0x4 + Accept Atom = 0x2106 + AcceptCharset Atom = 0x210e + Accesskey Atom = 0x3309 + Action Atom = 0x1f606 + Address Atom = 0x4f307 + Align Atom = 0x1105 + Alt Atom = 0x4503 + Annotation Atom = 0x1670a + AnnotationXml Atom = 0x1670e + Applet Atom = 0x2b306 + Area Atom = 0x2fa04 + Article Atom = 0x38807 + Aside Atom = 0x8305 + Async Atom = 0x7b05 + Audio Atom = 0xa605 + Autocomplete Atom = 0x1fc0c + Autofocus Atom = 0xb309 + Autoplay Atom = 0xce08 + B Atom = 0x101 + Base Atom = 0xd604 + Basefont Atom = 0xd608 + Bdi Atom = 0x1a03 + Bdo Atom = 0xe703 + Bgsound Atom = 0x11807 + Big Atom = 0x12403 + Blink Atom = 0x12705 + Blockquote Atom = 0x12c0a + Body Atom = 0x2f04 + Br Atom = 0x202 + Button Atom = 0x13606 + Canvas Atom = 0x7f06 + Caption Atom = 0x1bb07 + Center Atom = 0x5b506 + Challenge Atom = 0x21f09 + Charset Atom = 0x2807 + Checked Atom = 0x32807 + Cite Atom = 0x3c804 + Class Atom = 0x4de05 + Code Atom = 0x14904 + Col Atom = 0x15003 + Colgroup Atom = 0x15008 + Color Atom = 0x15d05 + Cols Atom = 0x16204 + Colspan Atom = 0x16207 + Command Atom = 0x17507 + Content Atom = 0x42307 + Contenteditable Atom = 0x4230f + Contextmenu Atom = 0x3310b + Controls Atom = 0x18808 + Coords Atom = 0x19406 + Crossorigin Atom = 0x19f0b + Data Atom = 0x44a04 + Datalist Atom = 0x44a08 + Datetime Atom = 0x23c08 + Dd Atom = 0x26702 + Default Atom = 0x8607 + Defer Atom = 0x14b05 + Del Atom = 0x3ef03 + Desc Atom = 0x4db04 + Details Atom = 0x4807 + Dfn Atom = 0x6103 + Dialog Atom = 0x1b06 + Dir Atom = 0x6903 + Dirname Atom = 0x6907 + Disabled Atom = 0x10c08 + Div Atom = 0x11303 + Dl Atom = 0x11e02 + Download Atom = 0x40008 + Draggable Atom = 0x17b09 + Dropzone Atom = 0x39108 + Dt Atom = 0x50902 + Em Atom = 0x6502 + Embed Atom = 0x6505 + Enctype Atom = 0x21107 + Face Atom = 0x5b304 + Fieldset Atom = 0x1b008 + Figcaption Atom = 0x1b80a + Figure Atom = 0x1cc06 + Font Atom = 0xda04 + Footer Atom = 0x8d06 + For Atom = 0x1d803 + ForeignObject Atom = 0x1d80d + Foreignobject Atom = 0x1e50d + Form Atom = 0x1f204 + Formaction Atom = 0x1f20a + Formenctype Atom = 0x20d0b + Formmethod Atom = 0x2280a + Formnovalidate Atom = 0x2320e + Formtarget Atom = 0x2470a + Frame Atom = 0x9a05 + Frameset Atom = 0x9a08 + H1 Atom = 0x26e02 + H2 Atom = 0x29402 + H3 Atom = 0x2a702 + H4 Atom = 0x2e902 + H5 Atom = 0x2f302 + H6 Atom = 0x50b02 + Head Atom = 0x2d504 + Header Atom = 0x2d506 + Headers Atom = 0x2d507 + Height Atom = 0x25106 + Hgroup Atom = 0x25906 + Hidden Atom = 0x26506 + High Atom = 0x26b04 + Hr Atom = 0x27002 + Href Atom = 0x27004 + Hreflang Atom = 0x27008 + Html Atom = 0x25504 + HttpEquiv Atom = 0x2780a + I Atom = 0x601 + Icon Atom = 0x42204 + Id Atom = 0x8502 + Iframe Atom = 0x29606 + Image Atom = 0x29c05 + Img Atom = 0x2a103 + Input Atom = 0x3e805 + Inputmode Atom = 0x3e809 + Ins Atom = 0x1a803 + Isindex Atom = 0x2a907 + Ismap Atom = 0x2b005 + Itemid Atom = 0x33c06 + Itemprop Atom = 0x3c908 + Itemref Atom = 0x5ad07 + Itemscope Atom = 0x2b909 + Itemtype Atom = 0x2c308 + Kbd Atom = 0x1903 + Keygen Atom = 0x3906 + Keytype Atom = 0x53707 + Kind Atom = 0x10904 + Label Atom = 0xf005 + Lang Atom = 0x27404 + Legend Atom = 0x18206 + Li Atom = 0x1202 + Link Atom = 0x12804 + List Atom = 0x44e04 + Listing Atom = 0x44e07 + Loop Atom = 0xf404 + Low Atom = 0x11f03 + Malignmark Atom = 0x100a + Manifest Atom = 0x5f108 + Map Atom = 0x2b203 + Mark Atom = 0x1604 + Marquee Atom = 0x2cb07 + Math Atom = 0x2d204 + Max Atom = 0x2e103 + Maxlength Atom = 0x2e109 + Media Atom = 0x6e05 + Mediagroup Atom = 0x6e0a + Menu Atom = 0x33804 + Menuitem Atom = 0x33808 + Meta Atom = 0x45d04 + Meter Atom = 0x24205 + Method Atom = 0x22c06 + Mglyph Atom = 0x2a206 + Mi Atom = 0x2eb02 + Min Atom = 0x2eb03 + Minlength Atom = 0x2eb09 + Mn Atom = 0x23502 + Mo Atom = 0x3ed02 + Ms Atom = 0x2bc02 + Mtext Atom = 0x2f505 + Multiple Atom = 0x30308 + Muted Atom = 0x30b05 + Name Atom = 0x6c04 + Nav Atom = 0x3e03 + Nobr Atom = 0x5704 + Noembed Atom = 0x6307 + Noframes Atom = 0x9808 + Noscript Atom = 0x3d208 + Novalidate Atom = 0x2360a + Object Atom = 0x1ec06 + Ol Atom = 0xc902 + Onabort Atom = 0x13a07 + Onafterprint Atom = 0x1c00c + Onautocomplete Atom = 0x1fa0e + Onautocompleteerror Atom = 0x1fa13 + Onbeforeprint Atom = 0x6040d + Onbeforeunload Atom = 0x4e70e + Onblur Atom = 0xaa06 + Oncancel Atom = 0xe908 + Oncanplay Atom = 0x28509 + Oncanplaythrough Atom = 0x28510 + Onchange Atom = 0x3a708 + Onclick Atom = 0x31007 + Onclose Atom = 0x31707 + Oncontextmenu Atom = 0x32f0d + Oncuechange Atom = 0x3420b + Ondblclick Atom = 0x34d0a + Ondrag Atom = 0x35706 + Ondragend Atom = 0x35709 + Ondragenter Atom = 0x3600b + Ondragleave Atom = 0x36b0b + Ondragover Atom = 0x3760a + Ondragstart Atom = 0x3800b + Ondrop Atom = 0x38f06 + Ondurationchange Atom = 0x39f10 + Onemptied Atom = 0x39609 + Onended Atom = 0x3af07 + Onerror Atom = 0x3b607 + Onfocus Atom = 0x3bd07 + Onhashchange Atom = 0x3da0c + Oninput Atom = 0x3e607 + Oninvalid Atom = 0x3f209 + Onkeydown Atom = 0x3fb09 + Onkeypress Atom = 0x4080a + Onkeyup Atom = 0x41807 + Onlanguagechange Atom = 0x43210 + Onload Atom = 0x44206 + Onloadeddata Atom = 0x4420c + Onloadedmetadata Atom = 0x45510 + Onloadstart Atom = 0x46b0b + Onmessage Atom = 0x47609 + Onmousedown Atom = 0x47f0b + Onmousemove Atom = 0x48a0b + Onmouseout Atom = 0x4950a + Onmouseover Atom = 0x4a20b + Onmouseup Atom = 0x4ad09 + Onmousewheel Atom = 0x4b60c + Onoffline Atom = 0x4c209 + Ononline Atom = 0x4cb08 + Onpagehide Atom = 0x4d30a + Onpageshow Atom = 0x4fe0a + Onpause Atom = 0x50d07 + Onplay Atom = 0x51706 + Onplaying Atom = 0x51709 + Onpopstate Atom = 0x5200a + Onprogress Atom = 0x52a0a + Onratechange Atom = 0x53e0c + Onreset Atom = 0x54a07 + Onresize Atom = 0x55108 + Onscroll Atom = 0x55f08 + Onseeked Atom = 0x56708 + Onseeking Atom = 0x56f09 + Onselect Atom = 0x57808 + Onshow Atom = 0x58206 + Onsort Atom = 0x58b06 + Onstalled Atom = 0x59509 + Onstorage Atom = 0x59e09 + Onsubmit Atom = 0x5a708 + Onsuspend Atom = 0x5bb09 + Ontimeupdate Atom = 0xdb0c + Ontoggle Atom = 0x5c408 + Onunload Atom = 0x5cc08 + Onvolumechange Atom = 0x5d40e + Onwaiting Atom = 0x5e209 + Open Atom = 0x3cf04 + Optgroup Atom = 0xf608 + Optimum Atom = 0x5eb07 + Option Atom = 0x60006 + Output Atom = 0x49c06 + P Atom = 0xc01 + Param Atom = 0xc05 + Pattern Atom = 0x5107 + Ping Atom = 0x7704 + Placeholder Atom = 0xc30b + Plaintext Atom = 0xfd09 + Poster Atom = 0x15706 + Pre Atom = 0x25e03 + Preload Atom = 0x25e07 + Progress Atom = 0x52c08 + Prompt Atom = 0x5fa06 + Public Atom = 0x41e06 + Q Atom = 0x13101 + Radiogroup Atom = 0x30a + Readonly Atom = 0x2fb08 + Rel Atom = 0x25f03 + Required Atom = 0x1d008 + Reversed Atom = 0x5a08 + Rows Atom = 0x9204 + Rowspan Atom = 0x9207 + Rp Atom = 0x1c602 + Rt Atom = 0x13f02 + Ruby Atom = 0xaf04 + S Atom = 0x2c01 + Samp Atom = 0x4e04 + Sandbox Atom = 0xbb07 + Scope Atom = 0x2bd05 + Scoped Atom = 0x2bd06 + Script Atom = 0x3d406 + Seamless Atom = 0x31c08 + Section Atom = 0x4e207 + Select Atom = 0x57a06 + Selected Atom = 0x57a08 + Shape Atom = 0x4f905 + Size Atom = 0x55504 + Sizes Atom = 0x55505 + Small Atom = 0x18f05 + Sortable Atom = 0x58d08 + Sorted Atom = 0x19906 + Source Atom = 0x1aa06 + Spacer Atom = 0x2db06 + Span Atom = 0x9504 + Spellcheck Atom = 0x3230a + Src Atom = 0x3c303 + Srcdoc Atom = 0x3c306 + Srclang Atom = 0x41107 + Start Atom = 0x38605 + Step Atom = 0x5f704 + Strike Atom = 0x53306 + Strong Atom = 0x55906 + Style Atom = 0x61105 + Sub Atom = 0x5a903 + Summary Atom = 0x61607 + Sup Atom = 0x61d03 + Svg Atom = 0x62003 + System Atom = 0x62306 + Tabindex Atom = 0x46308 + Table Atom = 0x42d05 + Target Atom = 0x24b06 + Tbody Atom = 0x2e05 + Td Atom = 0x4702 + Template Atom = 0x62608 + Textarea Atom = 0x2f608 + Tfoot Atom = 0x8c05 + Th Atom = 0x22e02 + Thead Atom = 0x2d405 + Time Atom = 0xdd04 + Title Atom = 0xa105 + Tr Atom = 0x10502 + Track Atom = 0x10505 + Translate Atom = 0x14009 + Tt Atom = 0x5302 + Type Atom = 0x21404 + Typemustmatch Atom = 0x2140d + U Atom = 0xb01 + Ul Atom = 0x8a02 + Usemap Atom = 0x51106 + Value Atom = 0x4005 + Var Atom = 0x11503 + Video Atom = 0x28105 + Wbr Atom = 0x12103 + Width Atom = 0x50705 + Wrap Atom = 0x58704 + Xmp Atom = 0xc103 +) + +const hash0 = 0xc17da63e + +const maxAtomLen = 19 + +var table = [1 << 9]Atom{ + 0x1: 0x48a0b, // onmousemove + 0x2: 0x5e209, // onwaiting + 0x3: 0x1fa13, // onautocompleteerror + 0x4: 0x5fa06, // prompt + 0x7: 0x5eb07, // optimum + 0x8: 0x1604, // mark + 0xa: 0x5ad07, // itemref + 0xb: 0x4fe0a, // onpageshow + 0xc: 0x57a06, // select + 0xd: 0x17b09, // draggable + 0xe: 0x3e03, // nav + 0xf: 0x17507, // command + 0x11: 0xb01, // u + 0x14: 0x2d507, // headers + 0x15: 0x44a08, // datalist + 0x17: 0x4e04, // samp + 0x1a: 0x3fb09, // onkeydown + 0x1b: 0x55f08, // onscroll + 0x1c: 0x15003, // col + 0x20: 0x3c908, // itemprop + 0x21: 0x2780a, // http-equiv + 0x22: 0x61d03, // sup + 0x24: 0x1d008, // required + 0x2b: 0x25e07, // preload + 0x2c: 0x6040d, // onbeforeprint + 0x2d: 0x3600b, // ondragenter + 0x2e: 0x50902, // dt + 0x2f: 0x5a708, // onsubmit + 0x30: 0x27002, // hr + 0x31: 0x32f0d, // oncontextmenu + 0x33: 0x29c05, // image + 0x34: 0x50d07, // onpause + 0x35: 0x25906, // hgroup + 0x36: 0x7704, // ping + 0x37: 0x57808, // onselect + 0x3a: 0x11303, // div + 0x3b: 0x1fa0e, // onautocomplete + 0x40: 0x2eb02, // mi + 0x41: 0x31c08, // seamless + 0x42: 0x2807, // charset + 0x43: 0x8502, // id + 0x44: 0x5200a, // onpopstate + 0x45: 0x3ef03, // del + 0x46: 0x2cb07, // marquee + 0x47: 0x3309, // accesskey + 0x49: 0x8d06, // footer + 0x4a: 0x44e04, // list + 0x4b: 0x2b005, // ismap + 0x51: 0x33804, // menu + 0x52: 0x2f04, // body + 0x55: 0x9a08, // frameset + 0x56: 0x54a07, // onreset + 0x57: 0x12705, // blink + 0x58: 0xa105, // title + 0x59: 0x38807, // article + 0x5b: 0x22e02, // th + 0x5d: 0x13101, // q + 0x5e: 0x3cf04, // open + 0x5f: 0x2fa04, // area + 0x61: 0x44206, // onload + 0x62: 0xda04, // font + 0x63: 0xd604, // base + 0x64: 0x16207, // colspan + 0x65: 0x53707, // keytype + 0x66: 0x11e02, // dl + 0x68: 0x1b008, // fieldset + 0x6a: 0x2eb03, // min + 0x6b: 0x11503, // var + 0x6f: 0x2d506, // header + 0x70: 0x13f02, // rt + 0x71: 0x15008, // colgroup + 0x72: 0x23502, // mn + 0x74: 0x13a07, // onabort + 0x75: 0x3906, // keygen + 0x76: 0x4c209, // onoffline + 0x77: 0x21f09, // challenge + 0x78: 0x2b203, // map + 0x7a: 0x2e902, // h4 + 0x7b: 0x3b607, // onerror + 0x7c: 0x2e109, // maxlength + 0x7d: 0x2f505, // mtext + 0x7e: 0xbb07, // sandbox + 0x7f: 0x58b06, // onsort + 0x80: 0x100a, // malignmark + 0x81: 0x45d04, // meta + 0x82: 0x7b05, // async + 0x83: 0x2a702, // h3 + 0x84: 0x26702, // dd + 0x85: 0x27004, // href + 0x86: 0x6e0a, // mediagroup + 0x87: 0x19406, // coords + 0x88: 0x41107, // srclang + 0x89: 0x34d0a, // ondblclick + 0x8a: 0x4005, // value + 0x8c: 0xe908, // oncancel + 0x8e: 0x3230a, // spellcheck + 0x8f: 0x9a05, // frame + 0x91: 0x12403, // big + 0x94: 0x1f606, // action + 0x95: 0x6903, // dir + 0x97: 0x2fb08, // readonly + 0x99: 0x42d05, // table + 0x9a: 0x61607, // summary + 0x9b: 0x12103, // wbr + 0x9c: 0x30a, // radiogroup + 0x9d: 0x6c04, // name + 0x9f: 0x62306, // system + 0xa1: 0x15d05, // color + 0xa2: 0x7f06, // canvas + 0xa3: 0x25504, // html + 0xa5: 0x56f09, // onseeking + 0xac: 0x4f905, // shape + 0xad: 0x25f03, // rel + 0xae: 0x28510, // oncanplaythrough + 0xaf: 0x3760a, // ondragover + 0xb0: 0x62608, // template + 0xb1: 0x1d80d, // foreignObject + 0xb3: 0x9204, // rows + 0xb6: 0x44e07, // listing + 0xb7: 0x49c06, // output + 0xb9: 0x3310b, // contextmenu + 0xbb: 0x11f03, // low + 0xbc: 0x1c602, // rp + 0xbd: 0x5bb09, // onsuspend + 0xbe: 0x13606, // button + 0xbf: 0x4db04, // desc + 0xc1: 0x4e207, // section + 0xc2: 0x52a0a, // onprogress + 0xc3: 0x59e09, // onstorage + 0xc4: 0x2d204, // math + 0xc5: 0x4503, // alt + 0xc7: 0x8a02, // ul + 0xc8: 0x5107, // pattern + 0xc9: 0x4b60c, // onmousewheel + 0xca: 0x35709, // ondragend + 0xcb: 0xaf04, // ruby + 0xcc: 0xc01, // p + 0xcd: 0x31707, // onclose + 0xce: 0x24205, // meter + 0xcf: 0x11807, // bgsound + 0xd2: 0x25106, // height + 0xd4: 0x101, // b + 0xd5: 0x2c308, // itemtype + 0xd8: 0x1bb07, // caption + 0xd9: 0x10c08, // disabled + 0xdb: 0x33808, // menuitem + 0xdc: 0x62003, // svg + 0xdd: 0x18f05, // small + 0xde: 0x44a04, // data + 0xe0: 0x4cb08, // ononline + 0xe1: 0x2a206, // mglyph + 0xe3: 0x6505, // embed + 0xe4: 0x10502, // tr + 0xe5: 0x46b0b, // onloadstart + 0xe7: 0x3c306, // srcdoc + 0xeb: 0x5c408, // ontoggle + 0xed: 0xe703, // bdo + 0xee: 0x4702, // td + 0xef: 0x8305, // aside + 0xf0: 0x29402, // h2 + 0xf1: 0x52c08, // progress + 0xf2: 0x12c0a, // blockquote + 0xf4: 0xf005, // label + 0xf5: 0x601, // i + 0xf7: 0x9207, // rowspan + 0xfb: 0x51709, // onplaying + 0xfd: 0x2a103, // img + 0xfe: 0xf608, // optgroup + 0xff: 0x42307, // content + 0x101: 0x53e0c, // onratechange + 0x103: 0x3da0c, // onhashchange + 0x104: 0x4807, // details + 0x106: 0x40008, // download + 0x109: 0x14009, // translate + 0x10b: 0x4230f, // contenteditable + 0x10d: 0x36b0b, // ondragleave + 0x10e: 0x2106, // accept + 0x10f: 0x57a08, // selected + 0x112: 0x1f20a, // formaction + 0x113: 0x5b506, // center + 0x115: 0x45510, // onloadedmetadata + 0x116: 0x12804, // link + 0x117: 0xdd04, // time + 0x118: 0x19f0b, // crossorigin + 0x119: 0x3bd07, // onfocus + 0x11a: 0x58704, // wrap + 0x11b: 0x42204, // icon + 0x11d: 0x28105, // video + 0x11e: 0x4de05, // class + 0x121: 0x5d40e, // onvolumechange + 0x122: 0xaa06, // onblur + 0x123: 0x2b909, // itemscope + 0x124: 0x61105, // style + 0x127: 0x41e06, // public + 0x129: 0x2320e, // formnovalidate + 0x12a: 0x58206, // onshow + 0x12c: 0x51706, // onplay + 0x12d: 0x3c804, // cite + 0x12e: 0x2bc02, // ms + 0x12f: 0xdb0c, // ontimeupdate + 0x130: 0x10904, // kind + 0x131: 0x2470a, // formtarget + 0x135: 0x3af07, // onended + 0x136: 0x26506, // hidden + 0x137: 0x2c01, // s + 0x139: 0x2280a, // formmethod + 0x13a: 0x3e805, // input + 0x13c: 0x50b02, // h6 + 0x13d: 0xc902, // ol + 0x13e: 0x3420b, // oncuechange + 0x13f: 0x1e50d, // foreignobject + 0x143: 0x4e70e, // onbeforeunload + 0x144: 0x2bd05, // scope + 0x145: 0x39609, // onemptied + 0x146: 0x14b05, // defer + 0x147: 0xc103, // xmp + 0x148: 0x39f10, // ondurationchange + 0x149: 0x1903, // kbd + 0x14c: 0x47609, // onmessage + 0x14d: 0x60006, // option + 0x14e: 0x2eb09, // minlength + 0x14f: 0x32807, // checked + 0x150: 0xce08, // autoplay + 0x152: 0x202, // br + 0x153: 0x2360a, // novalidate + 0x156: 0x6307, // noembed + 0x159: 0x31007, // onclick + 0x15a: 0x47f0b, // onmousedown + 0x15b: 0x3a708, // onchange + 0x15e: 0x3f209, // oninvalid + 0x15f: 0x2bd06, // scoped + 0x160: 0x18808, // controls + 0x161: 0x30b05, // muted + 0x162: 0x58d08, // sortable + 0x163: 0x51106, // usemap + 0x164: 0x1b80a, // figcaption + 0x165: 0x35706, // ondrag + 0x166: 0x26b04, // high + 0x168: 0x3c303, // src + 0x169: 0x15706, // poster + 0x16b: 0x1670e, // annotation-xml + 0x16c: 0x5f704, // step + 0x16d: 0x4, // abbr + 0x16e: 0x1b06, // dialog + 0x170: 0x1202, // li + 0x172: 0x3ed02, // mo + 0x175: 0x1d803, // for + 0x176: 0x1a803, // ins + 0x178: 0x55504, // size + 0x179: 0x43210, // onlanguagechange + 0x17a: 0x8607, // default + 0x17b: 0x1a03, // bdi + 0x17c: 0x4d30a, // onpagehide + 0x17d: 0x6907, // dirname + 0x17e: 0x21404, // type + 0x17f: 0x1f204, // form + 0x181: 0x28509, // oncanplay + 0x182: 0x6103, // dfn + 0x183: 0x46308, // tabindex + 0x186: 0x6502, // em + 0x187: 0x27404, // lang + 0x189: 0x39108, // dropzone + 0x18a: 0x4080a, // onkeypress + 0x18b: 0x23c08, // datetime + 0x18c: 0x16204, // cols + 0x18d: 0x1, // a + 0x18e: 0x4420c, // onloadeddata + 0x190: 0xa605, // audio + 0x192: 0x2e05, // tbody + 0x193: 0x22c06, // method + 0x195: 0xf404, // loop + 0x196: 0x29606, // iframe + 0x198: 0x2d504, // head + 0x19e: 0x5f108, // manifest + 0x19f: 0xb309, // autofocus + 0x1a0: 0x14904, // code + 0x1a1: 0x55906, // strong + 0x1a2: 0x30308, // multiple + 0x1a3: 0xc05, // param + 0x1a6: 0x21107, // enctype + 0x1a7: 0x5b304, // face + 0x1a8: 0xfd09, // plaintext + 0x1a9: 0x26e02, // h1 + 0x1aa: 0x59509, // onstalled + 0x1ad: 0x3d406, // script + 0x1ae: 0x2db06, // spacer + 0x1af: 0x55108, // onresize + 0x1b0: 0x4a20b, // onmouseover + 0x1b1: 0x5cc08, // onunload + 0x1b2: 0x56708, // onseeked + 0x1b4: 0x2140d, // typemustmatch + 0x1b5: 0x1cc06, // figure + 0x1b6: 0x4950a, // onmouseout + 0x1b7: 0x25e03, // pre + 0x1b8: 0x50705, // width + 0x1b9: 0x19906, // sorted + 0x1bb: 0x5704, // nobr + 0x1be: 0x5302, // tt + 0x1bf: 0x1105, // align + 0x1c0: 0x3e607, // oninput + 0x1c3: 0x41807, // onkeyup + 0x1c6: 0x1c00c, // onafterprint + 0x1c7: 0x210e, // accept-charset + 0x1c8: 0x33c06, // itemid + 0x1c9: 0x3e809, // inputmode + 0x1cb: 0x53306, // strike + 0x1cc: 0x5a903, // sub + 0x1cd: 0x10505, // track + 0x1ce: 0x38605, // start + 0x1d0: 0xd608, // basefont + 0x1d6: 0x1aa06, // source + 0x1d7: 0x18206, // legend + 0x1d8: 0x2d405, // thead + 0x1da: 0x8c05, // tfoot + 0x1dd: 0x1ec06, // object + 0x1de: 0x6e05, // media + 0x1df: 0x1670a, // annotation + 0x1e0: 0x20d0b, // formenctype + 0x1e2: 0x3d208, // noscript + 0x1e4: 0x55505, // sizes + 0x1e5: 0x1fc0c, // autocomplete + 0x1e6: 0x9504, // span + 0x1e7: 0x9808, // noframes + 0x1e8: 0x24b06, // target + 0x1e9: 0x38f06, // ondrop + 0x1ea: 0x2b306, // applet + 0x1ec: 0x5a08, // reversed + 0x1f0: 0x2a907, // isindex + 0x1f3: 0x27008, // hreflang + 0x1f5: 0x2f302, // h5 + 0x1f6: 0x4f307, // address + 0x1fa: 0x2e103, // max + 0x1fb: 0xc30b, // placeholder + 0x1fc: 0x2f608, // textarea + 0x1fe: 0x4ad09, // onmouseup + 0x1ff: 0x3800b, // ondragstart +} + +const atomText = "abbradiogrouparamalignmarkbdialogaccept-charsetbodyaccesskey" + + "genavaluealtdetailsampatternobreversedfnoembedirnamediagroup" + + "ingasyncanvasidefaultfooterowspanoframesetitleaudionblurubya" + + "utofocusandboxmplaceholderautoplaybasefontimeupdatebdoncance" + + "labelooptgrouplaintextrackindisabledivarbgsoundlowbrbigblink" + + "blockquotebuttonabortranslatecodefercolgroupostercolorcolspa" + + "nnotation-xmlcommandraggablegendcontrolsmallcoordsortedcross" + + "originsourcefieldsetfigcaptionafterprintfigurequiredforeignO" + + "bjectforeignobjectformactionautocompleteerrorformenctypemust" + + "matchallengeformmethodformnovalidatetimeterformtargetheightm" + + "lhgroupreloadhiddenhigh1hreflanghttp-equivideoncanplaythroug" + + "h2iframeimageimglyph3isindexismappletitemscopeditemtypemarqu" + + "eematheaderspacermaxlength4minlength5mtextareadonlymultiplem" + + "utedonclickoncloseamlesspellcheckedoncontextmenuitemidoncuec" + + "hangeondblclickondragendondragenterondragleaveondragoverondr" + + "agstarticleondropzonemptiedondurationchangeonendedonerroronf" + + "ocusrcdocitempropenoscriptonhashchangeoninputmodeloninvalido" + + "nkeydownloadonkeypressrclangonkeyupublicontenteditableonlang" + + "uagechangeonloadeddatalistingonloadedmetadatabindexonloadsta" + + "rtonmessageonmousedownonmousemoveonmouseoutputonmouseoveronm" + + "ouseuponmousewheelonofflineononlineonpagehidesclassectionbef" + + "oreunloaddresshapeonpageshowidth6onpausemaponplayingonpopsta" + + "teonprogresstrikeytypeonratechangeonresetonresizestrongonscr" + + "ollonseekedonseekingonselectedonshowraponsortableonstalledon" + + "storageonsubmitemrefacenteronsuspendontoggleonunloadonvolume" + + "changeonwaitingoptimumanifestepromptoptionbeforeprintstylesu" + + "mmarysupsvgsystemplate" diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/charset/charset.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/charset/charset.go new file mode 100644 index 0000000000..13bed1599f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/charset/charset.go @@ -0,0 +1,257 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package charset provides common text encodings for HTML documents. +// +// The mapping from encoding labels to encodings is defined at +// https://encoding.spec.whatwg.org/. +package charset // import "golang.org/x/net/html/charset" + +import ( + "bytes" + "fmt" + "io" + "mime" + "strings" + "unicode/utf8" + + "golang.org/x/net/html" + "golang.org/x/text/encoding" + "golang.org/x/text/encoding/charmap" + "golang.org/x/text/encoding/htmlindex" + "golang.org/x/text/transform" +) + +// Lookup returns the encoding with the specified label, and its canonical +// name. It returns nil and the empty string if label is not one of the +// standard encodings for HTML. Matching is case-insensitive and ignores +// leading and trailing whitespace. Encoders will use HTML escape sequences for +// runes that are not supported by the character set. +func Lookup(label string) (e encoding.Encoding, name string) { + e, err := htmlindex.Get(label) + if err != nil { + return nil, "" + } + name, _ = htmlindex.Name(e) + return &htmlEncoding{e}, name +} + +type htmlEncoding struct{ encoding.Encoding } + +func (h *htmlEncoding) NewEncoder() *encoding.Encoder { + // HTML requires a non-terminating legacy encoder. We use HTML escapes to + // substitute unsupported code points. + return encoding.HTMLEscapeUnsupported(h.Encoding.NewEncoder()) +} + +// DetermineEncoding determines the encoding of an HTML document by examining +// up to the first 1024 bytes of content and the declared Content-Type. +// +// See http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#determining-the-character-encoding +func DetermineEncoding(content []byte, contentType string) (e encoding.Encoding, name string, certain bool) { + if len(content) > 1024 { + content = content[:1024] + } + + for _, b := range boms { + if bytes.HasPrefix(content, b.bom) { + e, name = Lookup(b.enc) + return e, name, true + } + } + + if _, params, err := mime.ParseMediaType(contentType); err == nil { + if cs, ok := params["charset"]; ok { + if e, name = Lookup(cs); e != nil { + return e, name, true + } + } + } + + if len(content) > 0 { + e, name = prescan(content) + if e != nil { + return e, name, false + } + } + + // Try to detect UTF-8. + // First eliminate any partial rune at the end. + for i := len(content) - 1; i >= 0 && i > len(content)-4; i-- { + b := content[i] + if b < 0x80 { + break + } + if utf8.RuneStart(b) { + content = content[:i] + break + } + } + hasHighBit := false + for _, c := range content { + if c >= 0x80 { + hasHighBit = true + break + } + } + if hasHighBit && utf8.Valid(content) { + return encoding.Nop, "utf-8", false + } + + // TODO: change default depending on user's locale? + return charmap.Windows1252, "windows-1252", false +} + +// NewReader returns an io.Reader that converts the content of r to UTF-8. +// It calls DetermineEncoding to find out what r's encoding is. +func NewReader(r io.Reader, contentType string) (io.Reader, error) { + preview := make([]byte, 1024) + n, err := io.ReadFull(r, preview) + switch { + case err == io.ErrUnexpectedEOF: + preview = preview[:n] + r = bytes.NewReader(preview) + case err != nil: + return nil, err + default: + r = io.MultiReader(bytes.NewReader(preview), r) + } + + if e, _, _ := DetermineEncoding(preview, contentType); e != encoding.Nop { + r = transform.NewReader(r, e.NewDecoder()) + } + return r, nil +} + +// NewReaderLabel returns a reader that converts from the specified charset to +// UTF-8. It uses Lookup to find the encoding that corresponds to label, and +// returns an error if Lookup returns nil. It is suitable for use as +// encoding/xml.Decoder's CharsetReader function. +func NewReaderLabel(label string, input io.Reader) (io.Reader, error) { + e, _ := Lookup(label) + if e == nil { + return nil, fmt.Errorf("unsupported charset: %q", label) + } + return transform.NewReader(input, e.NewDecoder()), nil +} + +func prescan(content []byte) (e encoding.Encoding, name string) { + z := html.NewTokenizer(bytes.NewReader(content)) + for { + switch z.Next() { + case html.ErrorToken: + return nil, "" + + case html.StartTagToken, html.SelfClosingTagToken: + tagName, hasAttr := z.TagName() + if !bytes.Equal(tagName, []byte("meta")) { + continue + } + attrList := make(map[string]bool) + gotPragma := false + + const ( + dontKnow = iota + doNeedPragma + doNotNeedPragma + ) + needPragma := dontKnow + + name = "" + e = nil + for hasAttr { + var key, val []byte + key, val, hasAttr = z.TagAttr() + ks := string(key) + if attrList[ks] { + continue + } + attrList[ks] = true + for i, c := range val { + if 'A' <= c && c <= 'Z' { + val[i] = c + 0x20 + } + } + + switch ks { + case "http-equiv": + if bytes.Equal(val, []byte("content-type")) { + gotPragma = true + } + + case "content": + if e == nil { + name = fromMetaElement(string(val)) + if name != "" { + e, name = Lookup(name) + if e != nil { + needPragma = doNeedPragma + } + } + } + + case "charset": + e, name = Lookup(string(val)) + needPragma = doNotNeedPragma + } + } + + if needPragma == dontKnow || needPragma == doNeedPragma && !gotPragma { + continue + } + + if strings.HasPrefix(name, "utf-16") { + name = "utf-8" + e = encoding.Nop + } + + if e != nil { + return e, name + } + } + } +} + +func fromMetaElement(s string) string { + for s != "" { + csLoc := strings.Index(s, "charset") + if csLoc == -1 { + return "" + } + s = s[csLoc+len("charset"):] + s = strings.TrimLeft(s, " \t\n\f\r") + if !strings.HasPrefix(s, "=") { + continue + } + s = s[1:] + s = strings.TrimLeft(s, " \t\n\f\r") + if s == "" { + return "" + } + if q := s[0]; q == '"' || q == '\'' { + s = s[1:] + closeQuote := strings.IndexRune(s, rune(q)) + if closeQuote == -1 { + return "" + } + return s[:closeQuote] + } + + end := strings.IndexAny(s, "; \t\n\f\r") + if end == -1 { + end = len(s) + } + return s[:end] + } + return "" +} + +var boms = []struct { + bom []byte + enc string +}{ + {[]byte{0xfe, 0xff}, "utf-16be"}, + {[]byte{0xff, 0xfe}, "utf-16le"}, + {[]byte{0xef, 0xbb, 0xbf}, "utf-8"}, +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/const.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/const.go new file mode 100644 index 0000000000..52f651ff6d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/const.go @@ -0,0 +1,102 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +// Section 12.2.3.2 of the HTML5 specification says "The following elements +// have varying levels of special parsing rules". +// https://html.spec.whatwg.org/multipage/syntax.html#the-stack-of-open-elements +var isSpecialElementMap = map[string]bool{ + "address": true, + "applet": true, + "area": true, + "article": true, + "aside": true, + "base": true, + "basefont": true, + "bgsound": true, + "blockquote": true, + "body": true, + "br": true, + "button": true, + "caption": true, + "center": true, + "col": true, + "colgroup": true, + "dd": true, + "details": true, + "dir": true, + "div": true, + "dl": true, + "dt": true, + "embed": true, + "fieldset": true, + "figcaption": true, + "figure": true, + "footer": true, + "form": true, + "frame": true, + "frameset": true, + "h1": true, + "h2": true, + "h3": true, + "h4": true, + "h5": true, + "h6": true, + "head": true, + "header": true, + "hgroup": true, + "hr": true, + "html": true, + "iframe": true, + "img": true, + "input": true, + "isindex": true, + "li": true, + "link": true, + "listing": true, + "marquee": true, + "menu": true, + "meta": true, + "nav": true, + "noembed": true, + "noframes": true, + "noscript": true, + "object": true, + "ol": true, + "p": true, + "param": true, + "plaintext": true, + "pre": true, + "script": true, + "section": true, + "select": true, + "source": true, + "style": true, + "summary": true, + "table": true, + "tbody": true, + "td": true, + "template": true, + "textarea": true, + "tfoot": true, + "th": true, + "thead": true, + "title": true, + "tr": true, + "track": true, + "ul": true, + "wbr": true, + "xmp": true, +} + +func isSpecialElement(element *Node) bool { + switch element.Namespace { + case "", "html": + return isSpecialElementMap[element.Data] + case "svg": + return element.Data == "foreignObject" + } + return false +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/doc.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/doc.go new file mode 100644 index 0000000000..94f496874a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/doc.go @@ -0,0 +1,106 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package html implements an HTML5-compliant tokenizer and parser. + +Tokenization is done by creating a Tokenizer for an io.Reader r. It is the +caller's responsibility to ensure that r provides UTF-8 encoded HTML. + + z := html.NewTokenizer(r) + +Given a Tokenizer z, the HTML is tokenized by repeatedly calling z.Next(), +which parses the next token and returns its type, or an error: + + for { + tt := z.Next() + if tt == html.ErrorToken { + // ... + return ... + } + // Process the current token. + } + +There are two APIs for retrieving the current token. The high-level API is to +call Token; the low-level API is to call Text or TagName / TagAttr. Both APIs +allow optionally calling Raw after Next but before Token, Text, TagName, or +TagAttr. In EBNF notation, the valid call sequence per token is: + + Next {Raw} [ Token | Text | TagName {TagAttr} ] + +Token returns an independent data structure that completely describes a token. +Entities (such as "<") are unescaped, tag names and attribute keys are +lower-cased, and attributes are collected into a []Attribute. For example: + + for { + if z.Next() == html.ErrorToken { + // Returning io.EOF indicates success. + return z.Err() + } + emitToken(z.Token()) + } + +The low-level API performs fewer allocations and copies, but the contents of +the []byte values returned by Text, TagName and TagAttr may change on the next +call to Next. For example, to extract an HTML page's anchor text: + + depth := 0 + for { + tt := z.Next() + switch tt { + case ErrorToken: + return z.Err() + case TextToken: + if depth > 0 { + // emitBytes should copy the []byte it receives, + // if it doesn't process it immediately. + emitBytes(z.Text()) + } + case StartTagToken, EndTagToken: + tn, _ := z.TagName() + if len(tn) == 1 && tn[0] == 'a' { + if tt == StartTagToken { + depth++ + } else { + depth-- + } + } + } + } + +Parsing is done by calling Parse with an io.Reader, which returns the root of +the parse tree (the document element) as a *Node. It is the caller's +responsibility to ensure that the Reader provides UTF-8 encoded HTML. For +example, to process each anchor node in depth-first order: + + doc, err := html.Parse(r) + if err != nil { + // ... + } + var f func(*html.Node) + f = func(n *html.Node) { + if n.Type == html.ElementNode && n.Data == "a" { + // Do something with n... + } + for c := n.FirstChild; c != nil; c = c.NextSibling { + f(c) + } + } + f(doc) + +The relevant specifications include: +https://html.spec.whatwg.org/multipage/syntax.html and +https://html.spec.whatwg.org/multipage/syntax.html#tokenization +*/ +package html // import "golang.org/x/net/html" + +// The tokenization algorithm implemented by this package is not a line-by-line +// transliteration of the relatively verbose state-machine in the WHATWG +// specification. A more direct approach is used instead, where the program +// counter implies the state, such as whether it is tokenizing a tag or a text +// node. Specification compliance is verified by checking expected and actual +// outputs over a test suite rather than aiming for algorithmic fidelity. + +// TODO(nigeltao): Does a DOM API belong in this package or a separate one? +// TODO(nigeltao): How does parsing interact with a JavaScript engine? diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/doctype.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/doctype.go new file mode 100644 index 0000000000..c484e5a94f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/doctype.go @@ -0,0 +1,156 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "strings" +) + +// parseDoctype parses the data from a DoctypeToken into a name, +// public identifier, and system identifier. It returns a Node whose Type +// is DoctypeNode, whose Data is the name, and which has attributes +// named "system" and "public" for the two identifiers if they were present. +// quirks is whether the document should be parsed in "quirks mode". +func parseDoctype(s string) (n *Node, quirks bool) { + n = &Node{Type: DoctypeNode} + + // Find the name. + space := strings.IndexAny(s, whitespace) + if space == -1 { + space = len(s) + } + n.Data = s[:space] + // The comparison to "html" is case-sensitive. + if n.Data != "html" { + quirks = true + } + n.Data = strings.ToLower(n.Data) + s = strings.TrimLeft(s[space:], whitespace) + + if len(s) < 6 { + // It can't start with "PUBLIC" or "SYSTEM". + // Ignore the rest of the string. + return n, quirks || s != "" + } + + key := strings.ToLower(s[:6]) + s = s[6:] + for key == "public" || key == "system" { + s = strings.TrimLeft(s, whitespace) + if s == "" { + break + } + quote := s[0] + if quote != '"' && quote != '\'' { + break + } + s = s[1:] + q := strings.IndexRune(s, rune(quote)) + var id string + if q == -1 { + id = s + s = "" + } else { + id = s[:q] + s = s[q+1:] + } + n.Attr = append(n.Attr, Attribute{Key: key, Val: id}) + if key == "public" { + key = "system" + } else { + key = "" + } + } + + if key != "" || s != "" { + quirks = true + } else if len(n.Attr) > 0 { + if n.Attr[0].Key == "public" { + public := strings.ToLower(n.Attr[0].Val) + switch public { + case "-//w3o//dtd w3 html strict 3.0//en//", "-/w3d/dtd html 4.0 transitional/en", "html": + quirks = true + default: + for _, q := range quirkyIDs { + if strings.HasPrefix(public, q) { + quirks = true + break + } + } + } + // The following two public IDs only cause quirks mode if there is no system ID. + if len(n.Attr) == 1 && (strings.HasPrefix(public, "-//w3c//dtd html 4.01 frameset//") || + strings.HasPrefix(public, "-//w3c//dtd html 4.01 transitional//")) { + quirks = true + } + } + if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" && + strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" { + quirks = true + } + } + + return n, quirks +} + +// quirkyIDs is a list of public doctype identifiers that cause a document +// to be interpreted in quirks mode. The identifiers should be in lower case. +var quirkyIDs = []string{ + "+//silmaril//dtd html pro v0r11 19970101//", + "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", + "-//as//dtd html 3.0 aswedit + extensions//", + "-//ietf//dtd html 2.0 level 1//", + "-//ietf//dtd html 2.0 level 2//", + "-//ietf//dtd html 2.0 strict level 1//", + "-//ietf//dtd html 2.0 strict level 2//", + "-//ietf//dtd html 2.0 strict//", + "-//ietf//dtd html 2.0//", + "-//ietf//dtd html 2.1e//", + "-//ietf//dtd html 3.0//", + "-//ietf//dtd html 3.2 final//", + "-//ietf//dtd html 3.2//", + "-//ietf//dtd html 3//", + "-//ietf//dtd html level 0//", + "-//ietf//dtd html level 1//", + "-//ietf//dtd html level 2//", + "-//ietf//dtd html level 3//", + "-//ietf//dtd html strict level 0//", + "-//ietf//dtd html strict level 1//", + "-//ietf//dtd html strict level 2//", + "-//ietf//dtd html strict level 3//", + "-//ietf//dtd html strict//", + "-//ietf//dtd html//", + "-//metrius//dtd metrius presentational//", + "-//microsoft//dtd internet explorer 2.0 html strict//", + "-//microsoft//dtd internet explorer 2.0 html//", + "-//microsoft//dtd internet explorer 2.0 tables//", + "-//microsoft//dtd internet explorer 3.0 html strict//", + "-//microsoft//dtd internet explorer 3.0 html//", + "-//microsoft//dtd internet explorer 3.0 tables//", + "-//netscape comm. corp.//dtd html//", + "-//netscape comm. corp.//dtd strict html//", + "-//o'reilly and associates//dtd html 2.0//", + "-//o'reilly and associates//dtd html extended 1.0//", + "-//o'reilly and associates//dtd html extended relaxed 1.0//", + "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", + "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", + "-//spyglass//dtd html 2.0 extended//", + "-//sq//dtd html 2.0 hotmetal + extensions//", + "-//sun microsystems corp.//dtd hotjava html//", + "-//sun microsystems corp.//dtd hotjava strict html//", + "-//w3c//dtd html 3 1995-03-24//", + "-//w3c//dtd html 3.2 draft//", + "-//w3c//dtd html 3.2 final//", + "-//w3c//dtd html 3.2//", + "-//w3c//dtd html 3.2s draft//", + "-//w3c//dtd html 4.0 frameset//", + "-//w3c//dtd html 4.0 transitional//", + "-//w3c//dtd html experimental 19960712//", + "-//w3c//dtd html experimental 970421//", + "-//w3c//dtd w3 html//", + "-//w3o//dtd w3 html 3.0//", + "-//webtechs//dtd mozilla html 2.0//", + "-//webtechs//dtd mozilla html//", +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/entity.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/entity.go new file mode 100644 index 0000000000..a50c04c60e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/entity.go @@ -0,0 +1,2253 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +// All entities that do not end with ';' are 6 or fewer bytes long. +const longestEntityWithoutSemicolon = 6 + +// entity is a map from HTML entity names to their values. The semicolon matters: +// https://html.spec.whatwg.org/multipage/syntax.html#named-character-references +// lists both "amp" and "amp;" as two separate entries. +// +// Note that the HTML5 list is larger than the HTML4 list at +// http://www.w3.org/TR/html4/sgml/entities.html +var entity = map[string]rune{ + "AElig;": '\U000000C6', + "AMP;": '\U00000026', + "Aacute;": '\U000000C1', + "Abreve;": '\U00000102', + "Acirc;": '\U000000C2', + "Acy;": '\U00000410', + "Afr;": '\U0001D504', + "Agrave;": '\U000000C0', + "Alpha;": '\U00000391', + "Amacr;": '\U00000100', + "And;": '\U00002A53', + "Aogon;": '\U00000104', + "Aopf;": '\U0001D538', + "ApplyFunction;": '\U00002061', + "Aring;": '\U000000C5', + "Ascr;": '\U0001D49C', + "Assign;": '\U00002254', + "Atilde;": '\U000000C3', + "Auml;": '\U000000C4', + "Backslash;": '\U00002216', + "Barv;": '\U00002AE7', + "Barwed;": '\U00002306', + "Bcy;": '\U00000411', + "Because;": '\U00002235', + "Bernoullis;": '\U0000212C', + "Beta;": '\U00000392', + "Bfr;": '\U0001D505', + "Bopf;": '\U0001D539', + "Breve;": '\U000002D8', + "Bscr;": '\U0000212C', + "Bumpeq;": '\U0000224E', + "CHcy;": '\U00000427', + "COPY;": '\U000000A9', + "Cacute;": '\U00000106', + "Cap;": '\U000022D2', + "CapitalDifferentialD;": '\U00002145', + "Cayleys;": '\U0000212D', + "Ccaron;": '\U0000010C', + "Ccedil;": '\U000000C7', + "Ccirc;": '\U00000108', + "Cconint;": '\U00002230', + "Cdot;": '\U0000010A', + "Cedilla;": '\U000000B8', + "CenterDot;": '\U000000B7', + "Cfr;": '\U0000212D', + "Chi;": '\U000003A7', + "CircleDot;": '\U00002299', + "CircleMinus;": '\U00002296', + "CirclePlus;": '\U00002295', + "CircleTimes;": '\U00002297', + "ClockwiseContourIntegral;": '\U00002232', + "CloseCurlyDoubleQuote;": '\U0000201D', + "CloseCurlyQuote;": '\U00002019', + "Colon;": '\U00002237', + "Colone;": '\U00002A74', + "Congruent;": '\U00002261', + "Conint;": '\U0000222F', + "ContourIntegral;": '\U0000222E', + "Copf;": '\U00002102', + "Coproduct;": '\U00002210', + "CounterClockwiseContourIntegral;": '\U00002233', + "Cross;": '\U00002A2F', + "Cscr;": '\U0001D49E', + "Cup;": '\U000022D3', + "CupCap;": '\U0000224D', + "DD;": '\U00002145', + "DDotrahd;": '\U00002911', + "DJcy;": '\U00000402', + "DScy;": '\U00000405', + "DZcy;": '\U0000040F', + "Dagger;": '\U00002021', + "Darr;": '\U000021A1', + "Dashv;": '\U00002AE4', + "Dcaron;": '\U0000010E', + "Dcy;": '\U00000414', + "Del;": '\U00002207', + "Delta;": '\U00000394', + "Dfr;": '\U0001D507', + "DiacriticalAcute;": '\U000000B4', + "DiacriticalDot;": '\U000002D9', + "DiacriticalDoubleAcute;": '\U000002DD', + "DiacriticalGrave;": '\U00000060', + "DiacriticalTilde;": '\U000002DC', + "Diamond;": '\U000022C4', + "DifferentialD;": '\U00002146', + "Dopf;": '\U0001D53B', + "Dot;": '\U000000A8', + "DotDot;": '\U000020DC', + "DotEqual;": '\U00002250', + "DoubleContourIntegral;": '\U0000222F', + "DoubleDot;": '\U000000A8', + "DoubleDownArrow;": '\U000021D3', + "DoubleLeftArrow;": '\U000021D0', + "DoubleLeftRightArrow;": '\U000021D4', + "DoubleLeftTee;": '\U00002AE4', + "DoubleLongLeftArrow;": '\U000027F8', + "DoubleLongLeftRightArrow;": '\U000027FA', + "DoubleLongRightArrow;": '\U000027F9', + "DoubleRightArrow;": '\U000021D2', + "DoubleRightTee;": '\U000022A8', + "DoubleUpArrow;": '\U000021D1', + "DoubleUpDownArrow;": '\U000021D5', + "DoubleVerticalBar;": '\U00002225', + "DownArrow;": '\U00002193', + "DownArrowBar;": '\U00002913', + "DownArrowUpArrow;": '\U000021F5', + "DownBreve;": '\U00000311', + "DownLeftRightVector;": '\U00002950', + "DownLeftTeeVector;": '\U0000295E', + "DownLeftVector;": '\U000021BD', + "DownLeftVectorBar;": '\U00002956', + "DownRightTeeVector;": '\U0000295F', + "DownRightVector;": '\U000021C1', + "DownRightVectorBar;": '\U00002957', + "DownTee;": '\U000022A4', + "DownTeeArrow;": '\U000021A7', + "Downarrow;": '\U000021D3', + "Dscr;": '\U0001D49F', + "Dstrok;": '\U00000110', + "ENG;": '\U0000014A', + "ETH;": '\U000000D0', + "Eacute;": '\U000000C9', + "Ecaron;": '\U0000011A', + "Ecirc;": '\U000000CA', + "Ecy;": '\U0000042D', + "Edot;": '\U00000116', + "Efr;": '\U0001D508', + "Egrave;": '\U000000C8', + "Element;": '\U00002208', + "Emacr;": '\U00000112', + "EmptySmallSquare;": '\U000025FB', + "EmptyVerySmallSquare;": '\U000025AB', + "Eogon;": '\U00000118', + "Eopf;": '\U0001D53C', + "Epsilon;": '\U00000395', + "Equal;": '\U00002A75', + "EqualTilde;": '\U00002242', + "Equilibrium;": '\U000021CC', + "Escr;": '\U00002130', + "Esim;": '\U00002A73', + "Eta;": '\U00000397', + "Euml;": '\U000000CB', + "Exists;": '\U00002203', + "ExponentialE;": '\U00002147', + "Fcy;": '\U00000424', + "Ffr;": '\U0001D509', + "FilledSmallSquare;": '\U000025FC', + "FilledVerySmallSquare;": '\U000025AA', + "Fopf;": '\U0001D53D', + "ForAll;": '\U00002200', + "Fouriertrf;": '\U00002131', + "Fscr;": '\U00002131', + "GJcy;": '\U00000403', + "GT;": '\U0000003E', + "Gamma;": '\U00000393', + "Gammad;": '\U000003DC', + "Gbreve;": '\U0000011E', + "Gcedil;": '\U00000122', + "Gcirc;": '\U0000011C', + "Gcy;": '\U00000413', + "Gdot;": '\U00000120', + "Gfr;": '\U0001D50A', + "Gg;": '\U000022D9', + "Gopf;": '\U0001D53E', + "GreaterEqual;": '\U00002265', + "GreaterEqualLess;": '\U000022DB', + "GreaterFullEqual;": '\U00002267', + "GreaterGreater;": '\U00002AA2', + "GreaterLess;": '\U00002277', + "GreaterSlantEqual;": '\U00002A7E', + "GreaterTilde;": '\U00002273', + "Gscr;": '\U0001D4A2', + "Gt;": '\U0000226B', + "HARDcy;": '\U0000042A', + "Hacek;": '\U000002C7', + "Hat;": '\U0000005E', + "Hcirc;": '\U00000124', + "Hfr;": '\U0000210C', + "HilbertSpace;": '\U0000210B', + "Hopf;": '\U0000210D', + "HorizontalLine;": '\U00002500', + "Hscr;": '\U0000210B', + "Hstrok;": '\U00000126', + "HumpDownHump;": '\U0000224E', + "HumpEqual;": '\U0000224F', + "IEcy;": '\U00000415', + "IJlig;": '\U00000132', + "IOcy;": '\U00000401', + "Iacute;": '\U000000CD', + "Icirc;": '\U000000CE', + "Icy;": '\U00000418', + "Idot;": '\U00000130', + "Ifr;": '\U00002111', + "Igrave;": '\U000000CC', + "Im;": '\U00002111', + "Imacr;": '\U0000012A', + "ImaginaryI;": '\U00002148', + "Implies;": '\U000021D2', + "Int;": '\U0000222C', + "Integral;": '\U0000222B', + "Intersection;": '\U000022C2', + "InvisibleComma;": '\U00002063', + "InvisibleTimes;": '\U00002062', + "Iogon;": '\U0000012E', + "Iopf;": '\U0001D540', + "Iota;": '\U00000399', + "Iscr;": '\U00002110', + "Itilde;": '\U00000128', + "Iukcy;": '\U00000406', + "Iuml;": '\U000000CF', + "Jcirc;": '\U00000134', + "Jcy;": '\U00000419', + "Jfr;": '\U0001D50D', + "Jopf;": '\U0001D541', + "Jscr;": '\U0001D4A5', + "Jsercy;": '\U00000408', + "Jukcy;": '\U00000404', + "KHcy;": '\U00000425', + "KJcy;": '\U0000040C', + "Kappa;": '\U0000039A', + "Kcedil;": '\U00000136', + "Kcy;": '\U0000041A', + "Kfr;": '\U0001D50E', + "Kopf;": '\U0001D542', + "Kscr;": '\U0001D4A6', + "LJcy;": '\U00000409', + "LT;": '\U0000003C', + "Lacute;": '\U00000139', + "Lambda;": '\U0000039B', + "Lang;": '\U000027EA', + "Laplacetrf;": '\U00002112', + "Larr;": '\U0000219E', + "Lcaron;": '\U0000013D', + "Lcedil;": '\U0000013B', + "Lcy;": '\U0000041B', + "LeftAngleBracket;": '\U000027E8', + "LeftArrow;": '\U00002190', + "LeftArrowBar;": '\U000021E4', + "LeftArrowRightArrow;": '\U000021C6', + "LeftCeiling;": '\U00002308', + "LeftDoubleBracket;": '\U000027E6', + "LeftDownTeeVector;": '\U00002961', + "LeftDownVector;": '\U000021C3', + "LeftDownVectorBar;": '\U00002959', + "LeftFloor;": '\U0000230A', + "LeftRightArrow;": '\U00002194', + "LeftRightVector;": '\U0000294E', + "LeftTee;": '\U000022A3', + "LeftTeeArrow;": '\U000021A4', + "LeftTeeVector;": '\U0000295A', + "LeftTriangle;": '\U000022B2', + "LeftTriangleBar;": '\U000029CF', + "LeftTriangleEqual;": '\U000022B4', + "LeftUpDownVector;": '\U00002951', + "LeftUpTeeVector;": '\U00002960', + "LeftUpVector;": '\U000021BF', + "LeftUpVectorBar;": '\U00002958', + "LeftVector;": '\U000021BC', + "LeftVectorBar;": '\U00002952', + "Leftarrow;": '\U000021D0', + "Leftrightarrow;": '\U000021D4', + "LessEqualGreater;": '\U000022DA', + "LessFullEqual;": '\U00002266', + "LessGreater;": '\U00002276', + "LessLess;": '\U00002AA1', + "LessSlantEqual;": '\U00002A7D', + "LessTilde;": '\U00002272', + "Lfr;": '\U0001D50F', + "Ll;": '\U000022D8', + "Lleftarrow;": '\U000021DA', + "Lmidot;": '\U0000013F', + "LongLeftArrow;": '\U000027F5', + "LongLeftRightArrow;": '\U000027F7', + "LongRightArrow;": '\U000027F6', + "Longleftarrow;": '\U000027F8', + "Longleftrightarrow;": '\U000027FA', + "Longrightarrow;": '\U000027F9', + "Lopf;": '\U0001D543', + "LowerLeftArrow;": '\U00002199', + "LowerRightArrow;": '\U00002198', + "Lscr;": '\U00002112', + "Lsh;": '\U000021B0', + "Lstrok;": '\U00000141', + "Lt;": '\U0000226A', + "Map;": '\U00002905', + "Mcy;": '\U0000041C', + "MediumSpace;": '\U0000205F', + "Mellintrf;": '\U00002133', + "Mfr;": '\U0001D510', + "MinusPlus;": '\U00002213', + "Mopf;": '\U0001D544', + "Mscr;": '\U00002133', + "Mu;": '\U0000039C', + "NJcy;": '\U0000040A', + "Nacute;": '\U00000143', + "Ncaron;": '\U00000147', + "Ncedil;": '\U00000145', + "Ncy;": '\U0000041D', + "NegativeMediumSpace;": '\U0000200B', + "NegativeThickSpace;": '\U0000200B', + "NegativeThinSpace;": '\U0000200B', + "NegativeVeryThinSpace;": '\U0000200B', + "NestedGreaterGreater;": '\U0000226B', + "NestedLessLess;": '\U0000226A', + "NewLine;": '\U0000000A', + "Nfr;": '\U0001D511', + "NoBreak;": '\U00002060', + "NonBreakingSpace;": '\U000000A0', + "Nopf;": '\U00002115', + "Not;": '\U00002AEC', + "NotCongruent;": '\U00002262', + "NotCupCap;": '\U0000226D', + "NotDoubleVerticalBar;": '\U00002226', + "NotElement;": '\U00002209', + "NotEqual;": '\U00002260', + "NotExists;": '\U00002204', + "NotGreater;": '\U0000226F', + "NotGreaterEqual;": '\U00002271', + "NotGreaterLess;": '\U00002279', + "NotGreaterTilde;": '\U00002275', + "NotLeftTriangle;": '\U000022EA', + "NotLeftTriangleEqual;": '\U000022EC', + "NotLess;": '\U0000226E', + "NotLessEqual;": '\U00002270', + "NotLessGreater;": '\U00002278', + "NotLessTilde;": '\U00002274', + "NotPrecedes;": '\U00002280', + "NotPrecedesSlantEqual;": '\U000022E0', + "NotReverseElement;": '\U0000220C', + "NotRightTriangle;": '\U000022EB', + "NotRightTriangleEqual;": '\U000022ED', + "NotSquareSubsetEqual;": '\U000022E2', + "NotSquareSupersetEqual;": '\U000022E3', + "NotSubsetEqual;": '\U00002288', + "NotSucceeds;": '\U00002281', + "NotSucceedsSlantEqual;": '\U000022E1', + "NotSupersetEqual;": '\U00002289', + "NotTilde;": '\U00002241', + "NotTildeEqual;": '\U00002244', + "NotTildeFullEqual;": '\U00002247', + "NotTildeTilde;": '\U00002249', + "NotVerticalBar;": '\U00002224', + "Nscr;": '\U0001D4A9', + "Ntilde;": '\U000000D1', + "Nu;": '\U0000039D', + "OElig;": '\U00000152', + "Oacute;": '\U000000D3', + "Ocirc;": '\U000000D4', + "Ocy;": '\U0000041E', + "Odblac;": '\U00000150', + "Ofr;": '\U0001D512', + "Ograve;": '\U000000D2', + "Omacr;": '\U0000014C', + "Omega;": '\U000003A9', + "Omicron;": '\U0000039F', + "Oopf;": '\U0001D546', + "OpenCurlyDoubleQuote;": '\U0000201C', + "OpenCurlyQuote;": '\U00002018', + "Or;": '\U00002A54', + "Oscr;": '\U0001D4AA', + "Oslash;": '\U000000D8', + "Otilde;": '\U000000D5', + "Otimes;": '\U00002A37', + "Ouml;": '\U000000D6', + "OverBar;": '\U0000203E', + "OverBrace;": '\U000023DE', + "OverBracket;": '\U000023B4', + "OverParenthesis;": '\U000023DC', + "PartialD;": '\U00002202', + "Pcy;": '\U0000041F', + "Pfr;": '\U0001D513', + "Phi;": '\U000003A6', + "Pi;": '\U000003A0', + "PlusMinus;": '\U000000B1', + "Poincareplane;": '\U0000210C', + "Popf;": '\U00002119', + "Pr;": '\U00002ABB', + "Precedes;": '\U0000227A', + "PrecedesEqual;": '\U00002AAF', + "PrecedesSlantEqual;": '\U0000227C', + "PrecedesTilde;": '\U0000227E', + "Prime;": '\U00002033', + "Product;": '\U0000220F', + "Proportion;": '\U00002237', + "Proportional;": '\U0000221D', + "Pscr;": '\U0001D4AB', + "Psi;": '\U000003A8', + "QUOT;": '\U00000022', + "Qfr;": '\U0001D514', + "Qopf;": '\U0000211A', + "Qscr;": '\U0001D4AC', + "RBarr;": '\U00002910', + "REG;": '\U000000AE', + "Racute;": '\U00000154', + "Rang;": '\U000027EB', + "Rarr;": '\U000021A0', + "Rarrtl;": '\U00002916', + "Rcaron;": '\U00000158', + "Rcedil;": '\U00000156', + "Rcy;": '\U00000420', + "Re;": '\U0000211C', + "ReverseElement;": '\U0000220B', + "ReverseEquilibrium;": '\U000021CB', + "ReverseUpEquilibrium;": '\U0000296F', + "Rfr;": '\U0000211C', + "Rho;": '\U000003A1', + "RightAngleBracket;": '\U000027E9', + "RightArrow;": '\U00002192', + "RightArrowBar;": '\U000021E5', + "RightArrowLeftArrow;": '\U000021C4', + "RightCeiling;": '\U00002309', + "RightDoubleBracket;": '\U000027E7', + "RightDownTeeVector;": '\U0000295D', + "RightDownVector;": '\U000021C2', + "RightDownVectorBar;": '\U00002955', + "RightFloor;": '\U0000230B', + "RightTee;": '\U000022A2', + "RightTeeArrow;": '\U000021A6', + "RightTeeVector;": '\U0000295B', + "RightTriangle;": '\U000022B3', + "RightTriangleBar;": '\U000029D0', + "RightTriangleEqual;": '\U000022B5', + "RightUpDownVector;": '\U0000294F', + "RightUpTeeVector;": '\U0000295C', + "RightUpVector;": '\U000021BE', + "RightUpVectorBar;": '\U00002954', + "RightVector;": '\U000021C0', + "RightVectorBar;": '\U00002953', + "Rightarrow;": '\U000021D2', + "Ropf;": '\U0000211D', + "RoundImplies;": '\U00002970', + "Rrightarrow;": '\U000021DB', + "Rscr;": '\U0000211B', + "Rsh;": '\U000021B1', + "RuleDelayed;": '\U000029F4', + "SHCHcy;": '\U00000429', + "SHcy;": '\U00000428', + "SOFTcy;": '\U0000042C', + "Sacute;": '\U0000015A', + "Sc;": '\U00002ABC', + "Scaron;": '\U00000160', + "Scedil;": '\U0000015E', + "Scirc;": '\U0000015C', + "Scy;": '\U00000421', + "Sfr;": '\U0001D516', + "ShortDownArrow;": '\U00002193', + "ShortLeftArrow;": '\U00002190', + "ShortRightArrow;": '\U00002192', + "ShortUpArrow;": '\U00002191', + "Sigma;": '\U000003A3', + "SmallCircle;": '\U00002218', + "Sopf;": '\U0001D54A', + "Sqrt;": '\U0000221A', + "Square;": '\U000025A1', + "SquareIntersection;": '\U00002293', + "SquareSubset;": '\U0000228F', + "SquareSubsetEqual;": '\U00002291', + "SquareSuperset;": '\U00002290', + "SquareSupersetEqual;": '\U00002292', + "SquareUnion;": '\U00002294', + "Sscr;": '\U0001D4AE', + "Star;": '\U000022C6', + "Sub;": '\U000022D0', + "Subset;": '\U000022D0', + "SubsetEqual;": '\U00002286', + "Succeeds;": '\U0000227B', + "SucceedsEqual;": '\U00002AB0', + "SucceedsSlantEqual;": '\U0000227D', + "SucceedsTilde;": '\U0000227F', + "SuchThat;": '\U0000220B', + "Sum;": '\U00002211', + "Sup;": '\U000022D1', + "Superset;": '\U00002283', + "SupersetEqual;": '\U00002287', + "Supset;": '\U000022D1', + "THORN;": '\U000000DE', + "TRADE;": '\U00002122', + "TSHcy;": '\U0000040B', + "TScy;": '\U00000426', + "Tab;": '\U00000009', + "Tau;": '\U000003A4', + "Tcaron;": '\U00000164', + "Tcedil;": '\U00000162', + "Tcy;": '\U00000422', + "Tfr;": '\U0001D517', + "Therefore;": '\U00002234', + "Theta;": '\U00000398', + "ThinSpace;": '\U00002009', + "Tilde;": '\U0000223C', + "TildeEqual;": '\U00002243', + "TildeFullEqual;": '\U00002245', + "TildeTilde;": '\U00002248', + "Topf;": '\U0001D54B', + "TripleDot;": '\U000020DB', + "Tscr;": '\U0001D4AF', + "Tstrok;": '\U00000166', + "Uacute;": '\U000000DA', + "Uarr;": '\U0000219F', + "Uarrocir;": '\U00002949', + "Ubrcy;": '\U0000040E', + "Ubreve;": '\U0000016C', + "Ucirc;": '\U000000DB', + "Ucy;": '\U00000423', + "Udblac;": '\U00000170', + "Ufr;": '\U0001D518', + "Ugrave;": '\U000000D9', + "Umacr;": '\U0000016A', + "UnderBar;": '\U0000005F', + "UnderBrace;": '\U000023DF', + "UnderBracket;": '\U000023B5', + "UnderParenthesis;": '\U000023DD', + "Union;": '\U000022C3', + "UnionPlus;": '\U0000228E', + "Uogon;": '\U00000172', + "Uopf;": '\U0001D54C', + "UpArrow;": '\U00002191', + "UpArrowBar;": '\U00002912', + "UpArrowDownArrow;": '\U000021C5', + "UpDownArrow;": '\U00002195', + "UpEquilibrium;": '\U0000296E', + "UpTee;": '\U000022A5', + "UpTeeArrow;": '\U000021A5', + "Uparrow;": '\U000021D1', + "Updownarrow;": '\U000021D5', + "UpperLeftArrow;": '\U00002196', + "UpperRightArrow;": '\U00002197', + "Upsi;": '\U000003D2', + "Upsilon;": '\U000003A5', + "Uring;": '\U0000016E', + "Uscr;": '\U0001D4B0', + "Utilde;": '\U00000168', + "Uuml;": '\U000000DC', + "VDash;": '\U000022AB', + "Vbar;": '\U00002AEB', + "Vcy;": '\U00000412', + "Vdash;": '\U000022A9', + "Vdashl;": '\U00002AE6', + "Vee;": '\U000022C1', + "Verbar;": '\U00002016', + "Vert;": '\U00002016', + "VerticalBar;": '\U00002223', + "VerticalLine;": '\U0000007C', + "VerticalSeparator;": '\U00002758', + "VerticalTilde;": '\U00002240', + "VeryThinSpace;": '\U0000200A', + "Vfr;": '\U0001D519', + "Vopf;": '\U0001D54D', + "Vscr;": '\U0001D4B1', + "Vvdash;": '\U000022AA', + "Wcirc;": '\U00000174', + "Wedge;": '\U000022C0', + "Wfr;": '\U0001D51A', + "Wopf;": '\U0001D54E', + "Wscr;": '\U0001D4B2', + "Xfr;": '\U0001D51B', + "Xi;": '\U0000039E', + "Xopf;": '\U0001D54F', + "Xscr;": '\U0001D4B3', + "YAcy;": '\U0000042F', + "YIcy;": '\U00000407', + "YUcy;": '\U0000042E', + "Yacute;": '\U000000DD', + "Ycirc;": '\U00000176', + "Ycy;": '\U0000042B', + "Yfr;": '\U0001D51C', + "Yopf;": '\U0001D550', + "Yscr;": '\U0001D4B4', + "Yuml;": '\U00000178', + "ZHcy;": '\U00000416', + "Zacute;": '\U00000179', + "Zcaron;": '\U0000017D', + "Zcy;": '\U00000417', + "Zdot;": '\U0000017B', + "ZeroWidthSpace;": '\U0000200B', + "Zeta;": '\U00000396', + "Zfr;": '\U00002128', + "Zopf;": '\U00002124', + "Zscr;": '\U0001D4B5', + "aacute;": '\U000000E1', + "abreve;": '\U00000103', + "ac;": '\U0000223E', + "acd;": '\U0000223F', + "acirc;": '\U000000E2', + "acute;": '\U000000B4', + "acy;": '\U00000430', + "aelig;": '\U000000E6', + "af;": '\U00002061', + "afr;": '\U0001D51E', + "agrave;": '\U000000E0', + "alefsym;": '\U00002135', + "aleph;": '\U00002135', + "alpha;": '\U000003B1', + "amacr;": '\U00000101', + "amalg;": '\U00002A3F', + "amp;": '\U00000026', + "and;": '\U00002227', + "andand;": '\U00002A55', + "andd;": '\U00002A5C', + "andslope;": '\U00002A58', + "andv;": '\U00002A5A', + "ang;": '\U00002220', + "ange;": '\U000029A4', + "angle;": '\U00002220', + "angmsd;": '\U00002221', + "angmsdaa;": '\U000029A8', + "angmsdab;": '\U000029A9', + "angmsdac;": '\U000029AA', + "angmsdad;": '\U000029AB', + "angmsdae;": '\U000029AC', + "angmsdaf;": '\U000029AD', + "angmsdag;": '\U000029AE', + "angmsdah;": '\U000029AF', + "angrt;": '\U0000221F', + "angrtvb;": '\U000022BE', + "angrtvbd;": '\U0000299D', + "angsph;": '\U00002222', + "angst;": '\U000000C5', + "angzarr;": '\U0000237C', + "aogon;": '\U00000105', + "aopf;": '\U0001D552', + "ap;": '\U00002248', + "apE;": '\U00002A70', + "apacir;": '\U00002A6F', + "ape;": '\U0000224A', + "apid;": '\U0000224B', + "apos;": '\U00000027', + "approx;": '\U00002248', + "approxeq;": '\U0000224A', + "aring;": '\U000000E5', + "ascr;": '\U0001D4B6', + "ast;": '\U0000002A', + "asymp;": '\U00002248', + "asympeq;": '\U0000224D', + "atilde;": '\U000000E3', + "auml;": '\U000000E4', + "awconint;": '\U00002233', + "awint;": '\U00002A11', + "bNot;": '\U00002AED', + "backcong;": '\U0000224C', + "backepsilon;": '\U000003F6', + "backprime;": '\U00002035', + "backsim;": '\U0000223D', + "backsimeq;": '\U000022CD', + "barvee;": '\U000022BD', + "barwed;": '\U00002305', + "barwedge;": '\U00002305', + "bbrk;": '\U000023B5', + "bbrktbrk;": '\U000023B6', + "bcong;": '\U0000224C', + "bcy;": '\U00000431', + "bdquo;": '\U0000201E', + "becaus;": '\U00002235', + "because;": '\U00002235', + "bemptyv;": '\U000029B0', + "bepsi;": '\U000003F6', + "bernou;": '\U0000212C', + "beta;": '\U000003B2', + "beth;": '\U00002136', + "between;": '\U0000226C', + "bfr;": '\U0001D51F', + "bigcap;": '\U000022C2', + "bigcirc;": '\U000025EF', + "bigcup;": '\U000022C3', + "bigodot;": '\U00002A00', + "bigoplus;": '\U00002A01', + "bigotimes;": '\U00002A02', + "bigsqcup;": '\U00002A06', + "bigstar;": '\U00002605', + "bigtriangledown;": '\U000025BD', + "bigtriangleup;": '\U000025B3', + "biguplus;": '\U00002A04', + "bigvee;": '\U000022C1', + "bigwedge;": '\U000022C0', + "bkarow;": '\U0000290D', + "blacklozenge;": '\U000029EB', + "blacksquare;": '\U000025AA', + "blacktriangle;": '\U000025B4', + "blacktriangledown;": '\U000025BE', + "blacktriangleleft;": '\U000025C2', + "blacktriangleright;": '\U000025B8', + "blank;": '\U00002423', + "blk12;": '\U00002592', + "blk14;": '\U00002591', + "blk34;": '\U00002593', + "block;": '\U00002588', + "bnot;": '\U00002310', + "bopf;": '\U0001D553', + "bot;": '\U000022A5', + "bottom;": '\U000022A5', + "bowtie;": '\U000022C8', + "boxDL;": '\U00002557', + "boxDR;": '\U00002554', + "boxDl;": '\U00002556', + "boxDr;": '\U00002553', + "boxH;": '\U00002550', + "boxHD;": '\U00002566', + "boxHU;": '\U00002569', + "boxHd;": '\U00002564', + "boxHu;": '\U00002567', + "boxUL;": '\U0000255D', + "boxUR;": '\U0000255A', + "boxUl;": '\U0000255C', + "boxUr;": '\U00002559', + "boxV;": '\U00002551', + "boxVH;": '\U0000256C', + "boxVL;": '\U00002563', + "boxVR;": '\U00002560', + "boxVh;": '\U0000256B', + "boxVl;": '\U00002562', + "boxVr;": '\U0000255F', + "boxbox;": '\U000029C9', + "boxdL;": '\U00002555', + "boxdR;": '\U00002552', + "boxdl;": '\U00002510', + "boxdr;": '\U0000250C', + "boxh;": '\U00002500', + "boxhD;": '\U00002565', + "boxhU;": '\U00002568', + "boxhd;": '\U0000252C', + "boxhu;": '\U00002534', + "boxminus;": '\U0000229F', + "boxplus;": '\U0000229E', + "boxtimes;": '\U000022A0', + "boxuL;": '\U0000255B', + "boxuR;": '\U00002558', + "boxul;": '\U00002518', + "boxur;": '\U00002514', + "boxv;": '\U00002502', + "boxvH;": '\U0000256A', + "boxvL;": '\U00002561', + "boxvR;": '\U0000255E', + "boxvh;": '\U0000253C', + "boxvl;": '\U00002524', + "boxvr;": '\U0000251C', + "bprime;": '\U00002035', + "breve;": '\U000002D8', + "brvbar;": '\U000000A6', + "bscr;": '\U0001D4B7', + "bsemi;": '\U0000204F', + "bsim;": '\U0000223D', + "bsime;": '\U000022CD', + "bsol;": '\U0000005C', + "bsolb;": '\U000029C5', + "bsolhsub;": '\U000027C8', + "bull;": '\U00002022', + "bullet;": '\U00002022', + "bump;": '\U0000224E', + "bumpE;": '\U00002AAE', + "bumpe;": '\U0000224F', + "bumpeq;": '\U0000224F', + "cacute;": '\U00000107', + "cap;": '\U00002229', + "capand;": '\U00002A44', + "capbrcup;": '\U00002A49', + "capcap;": '\U00002A4B', + "capcup;": '\U00002A47', + "capdot;": '\U00002A40', + "caret;": '\U00002041', + "caron;": '\U000002C7', + "ccaps;": '\U00002A4D', + "ccaron;": '\U0000010D', + "ccedil;": '\U000000E7', + "ccirc;": '\U00000109', + "ccups;": '\U00002A4C', + "ccupssm;": '\U00002A50', + "cdot;": '\U0000010B', + "cedil;": '\U000000B8', + "cemptyv;": '\U000029B2', + "cent;": '\U000000A2', + "centerdot;": '\U000000B7', + "cfr;": '\U0001D520', + "chcy;": '\U00000447', + "check;": '\U00002713', + "checkmark;": '\U00002713', + "chi;": '\U000003C7', + "cir;": '\U000025CB', + "cirE;": '\U000029C3', + "circ;": '\U000002C6', + "circeq;": '\U00002257', + "circlearrowleft;": '\U000021BA', + "circlearrowright;": '\U000021BB', + "circledR;": '\U000000AE', + "circledS;": '\U000024C8', + "circledast;": '\U0000229B', + "circledcirc;": '\U0000229A', + "circleddash;": '\U0000229D', + "cire;": '\U00002257', + "cirfnint;": '\U00002A10', + "cirmid;": '\U00002AEF', + "cirscir;": '\U000029C2', + "clubs;": '\U00002663', + "clubsuit;": '\U00002663', + "colon;": '\U0000003A', + "colone;": '\U00002254', + "coloneq;": '\U00002254', + "comma;": '\U0000002C', + "commat;": '\U00000040', + "comp;": '\U00002201', + "compfn;": '\U00002218', + "complement;": '\U00002201', + "complexes;": '\U00002102', + "cong;": '\U00002245', + "congdot;": '\U00002A6D', + "conint;": '\U0000222E', + "copf;": '\U0001D554', + "coprod;": '\U00002210', + "copy;": '\U000000A9', + "copysr;": '\U00002117', + "crarr;": '\U000021B5', + "cross;": '\U00002717', + "cscr;": '\U0001D4B8', + "csub;": '\U00002ACF', + "csube;": '\U00002AD1', + "csup;": '\U00002AD0', + "csupe;": '\U00002AD2', + "ctdot;": '\U000022EF', + "cudarrl;": '\U00002938', + "cudarrr;": '\U00002935', + "cuepr;": '\U000022DE', + "cuesc;": '\U000022DF', + "cularr;": '\U000021B6', + "cularrp;": '\U0000293D', + "cup;": '\U0000222A', + "cupbrcap;": '\U00002A48', + "cupcap;": '\U00002A46', + "cupcup;": '\U00002A4A', + "cupdot;": '\U0000228D', + "cupor;": '\U00002A45', + "curarr;": '\U000021B7', + "curarrm;": '\U0000293C', + "curlyeqprec;": '\U000022DE', + "curlyeqsucc;": '\U000022DF', + "curlyvee;": '\U000022CE', + "curlywedge;": '\U000022CF', + "curren;": '\U000000A4', + "curvearrowleft;": '\U000021B6', + "curvearrowright;": '\U000021B7', + "cuvee;": '\U000022CE', + "cuwed;": '\U000022CF', + "cwconint;": '\U00002232', + "cwint;": '\U00002231', + "cylcty;": '\U0000232D', + "dArr;": '\U000021D3', + "dHar;": '\U00002965', + "dagger;": '\U00002020', + "daleth;": '\U00002138', + "darr;": '\U00002193', + "dash;": '\U00002010', + "dashv;": '\U000022A3', + "dbkarow;": '\U0000290F', + "dblac;": '\U000002DD', + "dcaron;": '\U0000010F', + "dcy;": '\U00000434', + "dd;": '\U00002146', + "ddagger;": '\U00002021', + "ddarr;": '\U000021CA', + "ddotseq;": '\U00002A77', + "deg;": '\U000000B0', + "delta;": '\U000003B4', + "demptyv;": '\U000029B1', + "dfisht;": '\U0000297F', + "dfr;": '\U0001D521', + "dharl;": '\U000021C3', + "dharr;": '\U000021C2', + "diam;": '\U000022C4', + "diamond;": '\U000022C4', + "diamondsuit;": '\U00002666', + "diams;": '\U00002666', + "die;": '\U000000A8', + "digamma;": '\U000003DD', + "disin;": '\U000022F2', + "div;": '\U000000F7', + "divide;": '\U000000F7', + "divideontimes;": '\U000022C7', + "divonx;": '\U000022C7', + "djcy;": '\U00000452', + "dlcorn;": '\U0000231E', + "dlcrop;": '\U0000230D', + "dollar;": '\U00000024', + "dopf;": '\U0001D555', + "dot;": '\U000002D9', + "doteq;": '\U00002250', + "doteqdot;": '\U00002251', + "dotminus;": '\U00002238', + "dotplus;": '\U00002214', + "dotsquare;": '\U000022A1', + "doublebarwedge;": '\U00002306', + "downarrow;": '\U00002193', + "downdownarrows;": '\U000021CA', + "downharpoonleft;": '\U000021C3', + "downharpoonright;": '\U000021C2', + "drbkarow;": '\U00002910', + "drcorn;": '\U0000231F', + "drcrop;": '\U0000230C', + "dscr;": '\U0001D4B9', + "dscy;": '\U00000455', + "dsol;": '\U000029F6', + "dstrok;": '\U00000111', + "dtdot;": '\U000022F1', + "dtri;": '\U000025BF', + "dtrif;": '\U000025BE', + "duarr;": '\U000021F5', + "duhar;": '\U0000296F', + "dwangle;": '\U000029A6', + "dzcy;": '\U0000045F', + "dzigrarr;": '\U000027FF', + "eDDot;": '\U00002A77', + "eDot;": '\U00002251', + "eacute;": '\U000000E9', + "easter;": '\U00002A6E', + "ecaron;": '\U0000011B', + "ecir;": '\U00002256', + "ecirc;": '\U000000EA', + "ecolon;": '\U00002255', + "ecy;": '\U0000044D', + "edot;": '\U00000117', + "ee;": '\U00002147', + "efDot;": '\U00002252', + "efr;": '\U0001D522', + "eg;": '\U00002A9A', + "egrave;": '\U000000E8', + "egs;": '\U00002A96', + "egsdot;": '\U00002A98', + "el;": '\U00002A99', + "elinters;": '\U000023E7', + "ell;": '\U00002113', + "els;": '\U00002A95', + "elsdot;": '\U00002A97', + "emacr;": '\U00000113', + "empty;": '\U00002205', + "emptyset;": '\U00002205', + "emptyv;": '\U00002205', + "emsp;": '\U00002003', + "emsp13;": '\U00002004', + "emsp14;": '\U00002005', + "eng;": '\U0000014B', + "ensp;": '\U00002002', + "eogon;": '\U00000119', + "eopf;": '\U0001D556', + "epar;": '\U000022D5', + "eparsl;": '\U000029E3', + "eplus;": '\U00002A71', + "epsi;": '\U000003B5', + "epsilon;": '\U000003B5', + "epsiv;": '\U000003F5', + "eqcirc;": '\U00002256', + "eqcolon;": '\U00002255', + "eqsim;": '\U00002242', + "eqslantgtr;": '\U00002A96', + "eqslantless;": '\U00002A95', + "equals;": '\U0000003D', + "equest;": '\U0000225F', + "equiv;": '\U00002261', + "equivDD;": '\U00002A78', + "eqvparsl;": '\U000029E5', + "erDot;": '\U00002253', + "erarr;": '\U00002971', + "escr;": '\U0000212F', + "esdot;": '\U00002250', + "esim;": '\U00002242', + "eta;": '\U000003B7', + "eth;": '\U000000F0', + "euml;": '\U000000EB', + "euro;": '\U000020AC', + "excl;": '\U00000021', + "exist;": '\U00002203', + "expectation;": '\U00002130', + "exponentiale;": '\U00002147', + "fallingdotseq;": '\U00002252', + "fcy;": '\U00000444', + "female;": '\U00002640', + "ffilig;": '\U0000FB03', + "fflig;": '\U0000FB00', + "ffllig;": '\U0000FB04', + "ffr;": '\U0001D523', + "filig;": '\U0000FB01', + "flat;": '\U0000266D', + "fllig;": '\U0000FB02', + "fltns;": '\U000025B1', + "fnof;": '\U00000192', + "fopf;": '\U0001D557', + "forall;": '\U00002200', + "fork;": '\U000022D4', + "forkv;": '\U00002AD9', + "fpartint;": '\U00002A0D', + "frac12;": '\U000000BD', + "frac13;": '\U00002153', + "frac14;": '\U000000BC', + "frac15;": '\U00002155', + "frac16;": '\U00002159', + "frac18;": '\U0000215B', + "frac23;": '\U00002154', + "frac25;": '\U00002156', + "frac34;": '\U000000BE', + "frac35;": '\U00002157', + "frac38;": '\U0000215C', + "frac45;": '\U00002158', + "frac56;": '\U0000215A', + "frac58;": '\U0000215D', + "frac78;": '\U0000215E', + "frasl;": '\U00002044', + "frown;": '\U00002322', + "fscr;": '\U0001D4BB', + "gE;": '\U00002267', + "gEl;": '\U00002A8C', + "gacute;": '\U000001F5', + "gamma;": '\U000003B3', + "gammad;": '\U000003DD', + "gap;": '\U00002A86', + "gbreve;": '\U0000011F', + "gcirc;": '\U0000011D', + "gcy;": '\U00000433', + "gdot;": '\U00000121', + "ge;": '\U00002265', + "gel;": '\U000022DB', + "geq;": '\U00002265', + "geqq;": '\U00002267', + "geqslant;": '\U00002A7E', + "ges;": '\U00002A7E', + "gescc;": '\U00002AA9', + "gesdot;": '\U00002A80', + "gesdoto;": '\U00002A82', + "gesdotol;": '\U00002A84', + "gesles;": '\U00002A94', + "gfr;": '\U0001D524', + "gg;": '\U0000226B', + "ggg;": '\U000022D9', + "gimel;": '\U00002137', + "gjcy;": '\U00000453', + "gl;": '\U00002277', + "glE;": '\U00002A92', + "gla;": '\U00002AA5', + "glj;": '\U00002AA4', + "gnE;": '\U00002269', + "gnap;": '\U00002A8A', + "gnapprox;": '\U00002A8A', + "gne;": '\U00002A88', + "gneq;": '\U00002A88', + "gneqq;": '\U00002269', + "gnsim;": '\U000022E7', + "gopf;": '\U0001D558', + "grave;": '\U00000060', + "gscr;": '\U0000210A', + "gsim;": '\U00002273', + "gsime;": '\U00002A8E', + "gsiml;": '\U00002A90', + "gt;": '\U0000003E', + "gtcc;": '\U00002AA7', + "gtcir;": '\U00002A7A', + "gtdot;": '\U000022D7', + "gtlPar;": '\U00002995', + "gtquest;": '\U00002A7C', + "gtrapprox;": '\U00002A86', + "gtrarr;": '\U00002978', + "gtrdot;": '\U000022D7', + "gtreqless;": '\U000022DB', + "gtreqqless;": '\U00002A8C', + "gtrless;": '\U00002277', + "gtrsim;": '\U00002273', + "hArr;": '\U000021D4', + "hairsp;": '\U0000200A', + "half;": '\U000000BD', + "hamilt;": '\U0000210B', + "hardcy;": '\U0000044A', + "harr;": '\U00002194', + "harrcir;": '\U00002948', + "harrw;": '\U000021AD', + "hbar;": '\U0000210F', + "hcirc;": '\U00000125', + "hearts;": '\U00002665', + "heartsuit;": '\U00002665', + "hellip;": '\U00002026', + "hercon;": '\U000022B9', + "hfr;": '\U0001D525', + "hksearow;": '\U00002925', + "hkswarow;": '\U00002926', + "hoarr;": '\U000021FF', + "homtht;": '\U0000223B', + "hookleftarrow;": '\U000021A9', + "hookrightarrow;": '\U000021AA', + "hopf;": '\U0001D559', + "horbar;": '\U00002015', + "hscr;": '\U0001D4BD', + "hslash;": '\U0000210F', + "hstrok;": '\U00000127', + "hybull;": '\U00002043', + "hyphen;": '\U00002010', + "iacute;": '\U000000ED', + "ic;": '\U00002063', + "icirc;": '\U000000EE', + "icy;": '\U00000438', + "iecy;": '\U00000435', + "iexcl;": '\U000000A1', + "iff;": '\U000021D4', + "ifr;": '\U0001D526', + "igrave;": '\U000000EC', + "ii;": '\U00002148', + "iiiint;": '\U00002A0C', + "iiint;": '\U0000222D', + "iinfin;": '\U000029DC', + "iiota;": '\U00002129', + "ijlig;": '\U00000133', + "imacr;": '\U0000012B', + "image;": '\U00002111', + "imagline;": '\U00002110', + "imagpart;": '\U00002111', + "imath;": '\U00000131', + "imof;": '\U000022B7', + "imped;": '\U000001B5', + "in;": '\U00002208', + "incare;": '\U00002105', + "infin;": '\U0000221E', + "infintie;": '\U000029DD', + "inodot;": '\U00000131', + "int;": '\U0000222B', + "intcal;": '\U000022BA', + "integers;": '\U00002124', + "intercal;": '\U000022BA', + "intlarhk;": '\U00002A17', + "intprod;": '\U00002A3C', + "iocy;": '\U00000451', + "iogon;": '\U0000012F', + "iopf;": '\U0001D55A', + "iota;": '\U000003B9', + "iprod;": '\U00002A3C', + "iquest;": '\U000000BF', + "iscr;": '\U0001D4BE', + "isin;": '\U00002208', + "isinE;": '\U000022F9', + "isindot;": '\U000022F5', + "isins;": '\U000022F4', + "isinsv;": '\U000022F3', + "isinv;": '\U00002208', + "it;": '\U00002062', + "itilde;": '\U00000129', + "iukcy;": '\U00000456', + "iuml;": '\U000000EF', + "jcirc;": '\U00000135', + "jcy;": '\U00000439', + "jfr;": '\U0001D527', + "jmath;": '\U00000237', + "jopf;": '\U0001D55B', + "jscr;": '\U0001D4BF', + "jsercy;": '\U00000458', + "jukcy;": '\U00000454', + "kappa;": '\U000003BA', + "kappav;": '\U000003F0', + "kcedil;": '\U00000137', + "kcy;": '\U0000043A', + "kfr;": '\U0001D528', + "kgreen;": '\U00000138', + "khcy;": '\U00000445', + "kjcy;": '\U0000045C', + "kopf;": '\U0001D55C', + "kscr;": '\U0001D4C0', + "lAarr;": '\U000021DA', + "lArr;": '\U000021D0', + "lAtail;": '\U0000291B', + "lBarr;": '\U0000290E', + "lE;": '\U00002266', + "lEg;": '\U00002A8B', + "lHar;": '\U00002962', + "lacute;": '\U0000013A', + "laemptyv;": '\U000029B4', + "lagran;": '\U00002112', + "lambda;": '\U000003BB', + "lang;": '\U000027E8', + "langd;": '\U00002991', + "langle;": '\U000027E8', + "lap;": '\U00002A85', + "laquo;": '\U000000AB', + "larr;": '\U00002190', + "larrb;": '\U000021E4', + "larrbfs;": '\U0000291F', + "larrfs;": '\U0000291D', + "larrhk;": '\U000021A9', + "larrlp;": '\U000021AB', + "larrpl;": '\U00002939', + "larrsim;": '\U00002973', + "larrtl;": '\U000021A2', + "lat;": '\U00002AAB', + "latail;": '\U00002919', + "late;": '\U00002AAD', + "lbarr;": '\U0000290C', + "lbbrk;": '\U00002772', + "lbrace;": '\U0000007B', + "lbrack;": '\U0000005B', + "lbrke;": '\U0000298B', + "lbrksld;": '\U0000298F', + "lbrkslu;": '\U0000298D', + "lcaron;": '\U0000013E', + "lcedil;": '\U0000013C', + "lceil;": '\U00002308', + "lcub;": '\U0000007B', + "lcy;": '\U0000043B', + "ldca;": '\U00002936', + "ldquo;": '\U0000201C', + "ldquor;": '\U0000201E', + "ldrdhar;": '\U00002967', + "ldrushar;": '\U0000294B', + "ldsh;": '\U000021B2', + "le;": '\U00002264', + "leftarrow;": '\U00002190', + "leftarrowtail;": '\U000021A2', + "leftharpoondown;": '\U000021BD', + "leftharpoonup;": '\U000021BC', + "leftleftarrows;": '\U000021C7', + "leftrightarrow;": '\U00002194', + "leftrightarrows;": '\U000021C6', + "leftrightharpoons;": '\U000021CB', + "leftrightsquigarrow;": '\U000021AD', + "leftthreetimes;": '\U000022CB', + "leg;": '\U000022DA', + "leq;": '\U00002264', + "leqq;": '\U00002266', + "leqslant;": '\U00002A7D', + "les;": '\U00002A7D', + "lescc;": '\U00002AA8', + "lesdot;": '\U00002A7F', + "lesdoto;": '\U00002A81', + "lesdotor;": '\U00002A83', + "lesges;": '\U00002A93', + "lessapprox;": '\U00002A85', + "lessdot;": '\U000022D6', + "lesseqgtr;": '\U000022DA', + "lesseqqgtr;": '\U00002A8B', + "lessgtr;": '\U00002276', + "lesssim;": '\U00002272', + "lfisht;": '\U0000297C', + "lfloor;": '\U0000230A', + "lfr;": '\U0001D529', + "lg;": '\U00002276', + "lgE;": '\U00002A91', + "lhard;": '\U000021BD', + "lharu;": '\U000021BC', + "lharul;": '\U0000296A', + "lhblk;": '\U00002584', + "ljcy;": '\U00000459', + "ll;": '\U0000226A', + "llarr;": '\U000021C7', + "llcorner;": '\U0000231E', + "llhard;": '\U0000296B', + "lltri;": '\U000025FA', + "lmidot;": '\U00000140', + "lmoust;": '\U000023B0', + "lmoustache;": '\U000023B0', + "lnE;": '\U00002268', + "lnap;": '\U00002A89', + "lnapprox;": '\U00002A89', + "lne;": '\U00002A87', + "lneq;": '\U00002A87', + "lneqq;": '\U00002268', + "lnsim;": '\U000022E6', + "loang;": '\U000027EC', + "loarr;": '\U000021FD', + "lobrk;": '\U000027E6', + "longleftarrow;": '\U000027F5', + "longleftrightarrow;": '\U000027F7', + "longmapsto;": '\U000027FC', + "longrightarrow;": '\U000027F6', + "looparrowleft;": '\U000021AB', + "looparrowright;": '\U000021AC', + "lopar;": '\U00002985', + "lopf;": '\U0001D55D', + "loplus;": '\U00002A2D', + "lotimes;": '\U00002A34', + "lowast;": '\U00002217', + "lowbar;": '\U0000005F', + "loz;": '\U000025CA', + "lozenge;": '\U000025CA', + "lozf;": '\U000029EB', + "lpar;": '\U00000028', + "lparlt;": '\U00002993', + "lrarr;": '\U000021C6', + "lrcorner;": '\U0000231F', + "lrhar;": '\U000021CB', + "lrhard;": '\U0000296D', + "lrm;": '\U0000200E', + "lrtri;": '\U000022BF', + "lsaquo;": '\U00002039', + "lscr;": '\U0001D4C1', + "lsh;": '\U000021B0', + "lsim;": '\U00002272', + "lsime;": '\U00002A8D', + "lsimg;": '\U00002A8F', + "lsqb;": '\U0000005B', + "lsquo;": '\U00002018', + "lsquor;": '\U0000201A', + "lstrok;": '\U00000142', + "lt;": '\U0000003C', + "ltcc;": '\U00002AA6', + "ltcir;": '\U00002A79', + "ltdot;": '\U000022D6', + "lthree;": '\U000022CB', + "ltimes;": '\U000022C9', + "ltlarr;": '\U00002976', + "ltquest;": '\U00002A7B', + "ltrPar;": '\U00002996', + "ltri;": '\U000025C3', + "ltrie;": '\U000022B4', + "ltrif;": '\U000025C2', + "lurdshar;": '\U0000294A', + "luruhar;": '\U00002966', + "mDDot;": '\U0000223A', + "macr;": '\U000000AF', + "male;": '\U00002642', + "malt;": '\U00002720', + "maltese;": '\U00002720', + "map;": '\U000021A6', + "mapsto;": '\U000021A6', + "mapstodown;": '\U000021A7', + "mapstoleft;": '\U000021A4', + "mapstoup;": '\U000021A5', + "marker;": '\U000025AE', + "mcomma;": '\U00002A29', + "mcy;": '\U0000043C', + "mdash;": '\U00002014', + "measuredangle;": '\U00002221', + "mfr;": '\U0001D52A', + "mho;": '\U00002127', + "micro;": '\U000000B5', + "mid;": '\U00002223', + "midast;": '\U0000002A', + "midcir;": '\U00002AF0', + "middot;": '\U000000B7', + "minus;": '\U00002212', + "minusb;": '\U0000229F', + "minusd;": '\U00002238', + "minusdu;": '\U00002A2A', + "mlcp;": '\U00002ADB', + "mldr;": '\U00002026', + "mnplus;": '\U00002213', + "models;": '\U000022A7', + "mopf;": '\U0001D55E', + "mp;": '\U00002213', + "mscr;": '\U0001D4C2', + "mstpos;": '\U0000223E', + "mu;": '\U000003BC', + "multimap;": '\U000022B8', + "mumap;": '\U000022B8', + "nLeftarrow;": '\U000021CD', + "nLeftrightarrow;": '\U000021CE', + "nRightarrow;": '\U000021CF', + "nVDash;": '\U000022AF', + "nVdash;": '\U000022AE', + "nabla;": '\U00002207', + "nacute;": '\U00000144', + "nap;": '\U00002249', + "napos;": '\U00000149', + "napprox;": '\U00002249', + "natur;": '\U0000266E', + "natural;": '\U0000266E', + "naturals;": '\U00002115', + "nbsp;": '\U000000A0', + "ncap;": '\U00002A43', + "ncaron;": '\U00000148', + "ncedil;": '\U00000146', + "ncong;": '\U00002247', + "ncup;": '\U00002A42', + "ncy;": '\U0000043D', + "ndash;": '\U00002013', + "ne;": '\U00002260', + "neArr;": '\U000021D7', + "nearhk;": '\U00002924', + "nearr;": '\U00002197', + "nearrow;": '\U00002197', + "nequiv;": '\U00002262', + "nesear;": '\U00002928', + "nexist;": '\U00002204', + "nexists;": '\U00002204', + "nfr;": '\U0001D52B', + "nge;": '\U00002271', + "ngeq;": '\U00002271', + "ngsim;": '\U00002275', + "ngt;": '\U0000226F', + "ngtr;": '\U0000226F', + "nhArr;": '\U000021CE', + "nharr;": '\U000021AE', + "nhpar;": '\U00002AF2', + "ni;": '\U0000220B', + "nis;": '\U000022FC', + "nisd;": '\U000022FA', + "niv;": '\U0000220B', + "njcy;": '\U0000045A', + "nlArr;": '\U000021CD', + "nlarr;": '\U0000219A', + "nldr;": '\U00002025', + "nle;": '\U00002270', + "nleftarrow;": '\U0000219A', + "nleftrightarrow;": '\U000021AE', + "nleq;": '\U00002270', + "nless;": '\U0000226E', + "nlsim;": '\U00002274', + "nlt;": '\U0000226E', + "nltri;": '\U000022EA', + "nltrie;": '\U000022EC', + "nmid;": '\U00002224', + "nopf;": '\U0001D55F', + "not;": '\U000000AC', + "notin;": '\U00002209', + "notinva;": '\U00002209', + "notinvb;": '\U000022F7', + "notinvc;": '\U000022F6', + "notni;": '\U0000220C', + "notniva;": '\U0000220C', + "notnivb;": '\U000022FE', + "notnivc;": '\U000022FD', + "npar;": '\U00002226', + "nparallel;": '\U00002226', + "npolint;": '\U00002A14', + "npr;": '\U00002280', + "nprcue;": '\U000022E0', + "nprec;": '\U00002280', + "nrArr;": '\U000021CF', + "nrarr;": '\U0000219B', + "nrightarrow;": '\U0000219B', + "nrtri;": '\U000022EB', + "nrtrie;": '\U000022ED', + "nsc;": '\U00002281', + "nsccue;": '\U000022E1', + "nscr;": '\U0001D4C3', + "nshortmid;": '\U00002224', + "nshortparallel;": '\U00002226', + "nsim;": '\U00002241', + "nsime;": '\U00002244', + "nsimeq;": '\U00002244', + "nsmid;": '\U00002224', + "nspar;": '\U00002226', + "nsqsube;": '\U000022E2', + "nsqsupe;": '\U000022E3', + "nsub;": '\U00002284', + "nsube;": '\U00002288', + "nsubseteq;": '\U00002288', + "nsucc;": '\U00002281', + "nsup;": '\U00002285', + "nsupe;": '\U00002289', + "nsupseteq;": '\U00002289', + "ntgl;": '\U00002279', + "ntilde;": '\U000000F1', + "ntlg;": '\U00002278', + "ntriangleleft;": '\U000022EA', + "ntrianglelefteq;": '\U000022EC', + "ntriangleright;": '\U000022EB', + "ntrianglerighteq;": '\U000022ED', + "nu;": '\U000003BD', + "num;": '\U00000023', + "numero;": '\U00002116', + "numsp;": '\U00002007', + "nvDash;": '\U000022AD', + "nvHarr;": '\U00002904', + "nvdash;": '\U000022AC', + "nvinfin;": '\U000029DE', + "nvlArr;": '\U00002902', + "nvrArr;": '\U00002903', + "nwArr;": '\U000021D6', + "nwarhk;": '\U00002923', + "nwarr;": '\U00002196', + "nwarrow;": '\U00002196', + "nwnear;": '\U00002927', + "oS;": '\U000024C8', + "oacute;": '\U000000F3', + "oast;": '\U0000229B', + "ocir;": '\U0000229A', + "ocirc;": '\U000000F4', + "ocy;": '\U0000043E', + "odash;": '\U0000229D', + "odblac;": '\U00000151', + "odiv;": '\U00002A38', + "odot;": '\U00002299', + "odsold;": '\U000029BC', + "oelig;": '\U00000153', + "ofcir;": '\U000029BF', + "ofr;": '\U0001D52C', + "ogon;": '\U000002DB', + "ograve;": '\U000000F2', + "ogt;": '\U000029C1', + "ohbar;": '\U000029B5', + "ohm;": '\U000003A9', + "oint;": '\U0000222E', + "olarr;": '\U000021BA', + "olcir;": '\U000029BE', + "olcross;": '\U000029BB', + "oline;": '\U0000203E', + "olt;": '\U000029C0', + "omacr;": '\U0000014D', + "omega;": '\U000003C9', + "omicron;": '\U000003BF', + "omid;": '\U000029B6', + "ominus;": '\U00002296', + "oopf;": '\U0001D560', + "opar;": '\U000029B7', + "operp;": '\U000029B9', + "oplus;": '\U00002295', + "or;": '\U00002228', + "orarr;": '\U000021BB', + "ord;": '\U00002A5D', + "order;": '\U00002134', + "orderof;": '\U00002134', + "ordf;": '\U000000AA', + "ordm;": '\U000000BA', + "origof;": '\U000022B6', + "oror;": '\U00002A56', + "orslope;": '\U00002A57', + "orv;": '\U00002A5B', + "oscr;": '\U00002134', + "oslash;": '\U000000F8', + "osol;": '\U00002298', + "otilde;": '\U000000F5', + "otimes;": '\U00002297', + "otimesas;": '\U00002A36', + "ouml;": '\U000000F6', + "ovbar;": '\U0000233D', + "par;": '\U00002225', + "para;": '\U000000B6', + "parallel;": '\U00002225', + "parsim;": '\U00002AF3', + "parsl;": '\U00002AFD', + "part;": '\U00002202', + "pcy;": '\U0000043F', + "percnt;": '\U00000025', + "period;": '\U0000002E', + "permil;": '\U00002030', + "perp;": '\U000022A5', + "pertenk;": '\U00002031', + "pfr;": '\U0001D52D', + "phi;": '\U000003C6', + "phiv;": '\U000003D5', + "phmmat;": '\U00002133', + "phone;": '\U0000260E', + "pi;": '\U000003C0', + "pitchfork;": '\U000022D4', + "piv;": '\U000003D6', + "planck;": '\U0000210F', + "planckh;": '\U0000210E', + "plankv;": '\U0000210F', + "plus;": '\U0000002B', + "plusacir;": '\U00002A23', + "plusb;": '\U0000229E', + "pluscir;": '\U00002A22', + "plusdo;": '\U00002214', + "plusdu;": '\U00002A25', + "pluse;": '\U00002A72', + "plusmn;": '\U000000B1', + "plussim;": '\U00002A26', + "plustwo;": '\U00002A27', + "pm;": '\U000000B1', + "pointint;": '\U00002A15', + "popf;": '\U0001D561', + "pound;": '\U000000A3', + "pr;": '\U0000227A', + "prE;": '\U00002AB3', + "prap;": '\U00002AB7', + "prcue;": '\U0000227C', + "pre;": '\U00002AAF', + "prec;": '\U0000227A', + "precapprox;": '\U00002AB7', + "preccurlyeq;": '\U0000227C', + "preceq;": '\U00002AAF', + "precnapprox;": '\U00002AB9', + "precneqq;": '\U00002AB5', + "precnsim;": '\U000022E8', + "precsim;": '\U0000227E', + "prime;": '\U00002032', + "primes;": '\U00002119', + "prnE;": '\U00002AB5', + "prnap;": '\U00002AB9', + "prnsim;": '\U000022E8', + "prod;": '\U0000220F', + "profalar;": '\U0000232E', + "profline;": '\U00002312', + "profsurf;": '\U00002313', + "prop;": '\U0000221D', + "propto;": '\U0000221D', + "prsim;": '\U0000227E', + "prurel;": '\U000022B0', + "pscr;": '\U0001D4C5', + "psi;": '\U000003C8', + "puncsp;": '\U00002008', + "qfr;": '\U0001D52E', + "qint;": '\U00002A0C', + "qopf;": '\U0001D562', + "qprime;": '\U00002057', + "qscr;": '\U0001D4C6', + "quaternions;": '\U0000210D', + "quatint;": '\U00002A16', + "quest;": '\U0000003F', + "questeq;": '\U0000225F', + "quot;": '\U00000022', + "rAarr;": '\U000021DB', + "rArr;": '\U000021D2', + "rAtail;": '\U0000291C', + "rBarr;": '\U0000290F', + "rHar;": '\U00002964', + "racute;": '\U00000155', + "radic;": '\U0000221A', + "raemptyv;": '\U000029B3', + "rang;": '\U000027E9', + "rangd;": '\U00002992', + "range;": '\U000029A5', + "rangle;": '\U000027E9', + "raquo;": '\U000000BB', + "rarr;": '\U00002192', + "rarrap;": '\U00002975', + "rarrb;": '\U000021E5', + "rarrbfs;": '\U00002920', + "rarrc;": '\U00002933', + "rarrfs;": '\U0000291E', + "rarrhk;": '\U000021AA', + "rarrlp;": '\U000021AC', + "rarrpl;": '\U00002945', + "rarrsim;": '\U00002974', + "rarrtl;": '\U000021A3', + "rarrw;": '\U0000219D', + "ratail;": '\U0000291A', + "ratio;": '\U00002236', + "rationals;": '\U0000211A', + "rbarr;": '\U0000290D', + "rbbrk;": '\U00002773', + "rbrace;": '\U0000007D', + "rbrack;": '\U0000005D', + "rbrke;": '\U0000298C', + "rbrksld;": '\U0000298E', + "rbrkslu;": '\U00002990', + "rcaron;": '\U00000159', + "rcedil;": '\U00000157', + "rceil;": '\U00002309', + "rcub;": '\U0000007D', + "rcy;": '\U00000440', + "rdca;": '\U00002937', + "rdldhar;": '\U00002969', + "rdquo;": '\U0000201D', + "rdquor;": '\U0000201D', + "rdsh;": '\U000021B3', + "real;": '\U0000211C', + "realine;": '\U0000211B', + "realpart;": '\U0000211C', + "reals;": '\U0000211D', + "rect;": '\U000025AD', + "reg;": '\U000000AE', + "rfisht;": '\U0000297D', + "rfloor;": '\U0000230B', + "rfr;": '\U0001D52F', + "rhard;": '\U000021C1', + "rharu;": '\U000021C0', + "rharul;": '\U0000296C', + "rho;": '\U000003C1', + "rhov;": '\U000003F1', + "rightarrow;": '\U00002192', + "rightarrowtail;": '\U000021A3', + "rightharpoondown;": '\U000021C1', + "rightharpoonup;": '\U000021C0', + "rightleftarrows;": '\U000021C4', + "rightleftharpoons;": '\U000021CC', + "rightrightarrows;": '\U000021C9', + "rightsquigarrow;": '\U0000219D', + "rightthreetimes;": '\U000022CC', + "ring;": '\U000002DA', + "risingdotseq;": '\U00002253', + "rlarr;": '\U000021C4', + "rlhar;": '\U000021CC', + "rlm;": '\U0000200F', + "rmoust;": '\U000023B1', + "rmoustache;": '\U000023B1', + "rnmid;": '\U00002AEE', + "roang;": '\U000027ED', + "roarr;": '\U000021FE', + "robrk;": '\U000027E7', + "ropar;": '\U00002986', + "ropf;": '\U0001D563', + "roplus;": '\U00002A2E', + "rotimes;": '\U00002A35', + "rpar;": '\U00000029', + "rpargt;": '\U00002994', + "rppolint;": '\U00002A12', + "rrarr;": '\U000021C9', + "rsaquo;": '\U0000203A', + "rscr;": '\U0001D4C7', + "rsh;": '\U000021B1', + "rsqb;": '\U0000005D', + "rsquo;": '\U00002019', + "rsquor;": '\U00002019', + "rthree;": '\U000022CC', + "rtimes;": '\U000022CA', + "rtri;": '\U000025B9', + "rtrie;": '\U000022B5', + "rtrif;": '\U000025B8', + "rtriltri;": '\U000029CE', + "ruluhar;": '\U00002968', + "rx;": '\U0000211E', + "sacute;": '\U0000015B', + "sbquo;": '\U0000201A', + "sc;": '\U0000227B', + "scE;": '\U00002AB4', + "scap;": '\U00002AB8', + "scaron;": '\U00000161', + "sccue;": '\U0000227D', + "sce;": '\U00002AB0', + "scedil;": '\U0000015F', + "scirc;": '\U0000015D', + "scnE;": '\U00002AB6', + "scnap;": '\U00002ABA', + "scnsim;": '\U000022E9', + "scpolint;": '\U00002A13', + "scsim;": '\U0000227F', + "scy;": '\U00000441', + "sdot;": '\U000022C5', + "sdotb;": '\U000022A1', + "sdote;": '\U00002A66', + "seArr;": '\U000021D8', + "searhk;": '\U00002925', + "searr;": '\U00002198', + "searrow;": '\U00002198', + "sect;": '\U000000A7', + "semi;": '\U0000003B', + "seswar;": '\U00002929', + "setminus;": '\U00002216', + "setmn;": '\U00002216', + "sext;": '\U00002736', + "sfr;": '\U0001D530', + "sfrown;": '\U00002322', + "sharp;": '\U0000266F', + "shchcy;": '\U00000449', + "shcy;": '\U00000448', + "shortmid;": '\U00002223', + "shortparallel;": '\U00002225', + "shy;": '\U000000AD', + "sigma;": '\U000003C3', + "sigmaf;": '\U000003C2', + "sigmav;": '\U000003C2', + "sim;": '\U0000223C', + "simdot;": '\U00002A6A', + "sime;": '\U00002243', + "simeq;": '\U00002243', + "simg;": '\U00002A9E', + "simgE;": '\U00002AA0', + "siml;": '\U00002A9D', + "simlE;": '\U00002A9F', + "simne;": '\U00002246', + "simplus;": '\U00002A24', + "simrarr;": '\U00002972', + "slarr;": '\U00002190', + "smallsetminus;": '\U00002216', + "smashp;": '\U00002A33', + "smeparsl;": '\U000029E4', + "smid;": '\U00002223', + "smile;": '\U00002323', + "smt;": '\U00002AAA', + "smte;": '\U00002AAC', + "softcy;": '\U0000044C', + "sol;": '\U0000002F', + "solb;": '\U000029C4', + "solbar;": '\U0000233F', + "sopf;": '\U0001D564', + "spades;": '\U00002660', + "spadesuit;": '\U00002660', + "spar;": '\U00002225', + "sqcap;": '\U00002293', + "sqcup;": '\U00002294', + "sqsub;": '\U0000228F', + "sqsube;": '\U00002291', + "sqsubset;": '\U0000228F', + "sqsubseteq;": '\U00002291', + "sqsup;": '\U00002290', + "sqsupe;": '\U00002292', + "sqsupset;": '\U00002290', + "sqsupseteq;": '\U00002292', + "squ;": '\U000025A1', + "square;": '\U000025A1', + "squarf;": '\U000025AA', + "squf;": '\U000025AA', + "srarr;": '\U00002192', + "sscr;": '\U0001D4C8', + "ssetmn;": '\U00002216', + "ssmile;": '\U00002323', + "sstarf;": '\U000022C6', + "star;": '\U00002606', + "starf;": '\U00002605', + "straightepsilon;": '\U000003F5', + "straightphi;": '\U000003D5', + "strns;": '\U000000AF', + "sub;": '\U00002282', + "subE;": '\U00002AC5', + "subdot;": '\U00002ABD', + "sube;": '\U00002286', + "subedot;": '\U00002AC3', + "submult;": '\U00002AC1', + "subnE;": '\U00002ACB', + "subne;": '\U0000228A', + "subplus;": '\U00002ABF', + "subrarr;": '\U00002979', + "subset;": '\U00002282', + "subseteq;": '\U00002286', + "subseteqq;": '\U00002AC5', + "subsetneq;": '\U0000228A', + "subsetneqq;": '\U00002ACB', + "subsim;": '\U00002AC7', + "subsub;": '\U00002AD5', + "subsup;": '\U00002AD3', + "succ;": '\U0000227B', + "succapprox;": '\U00002AB8', + "succcurlyeq;": '\U0000227D', + "succeq;": '\U00002AB0', + "succnapprox;": '\U00002ABA', + "succneqq;": '\U00002AB6', + "succnsim;": '\U000022E9', + "succsim;": '\U0000227F', + "sum;": '\U00002211', + "sung;": '\U0000266A', + "sup;": '\U00002283', + "sup1;": '\U000000B9', + "sup2;": '\U000000B2', + "sup3;": '\U000000B3', + "supE;": '\U00002AC6', + "supdot;": '\U00002ABE', + "supdsub;": '\U00002AD8', + "supe;": '\U00002287', + "supedot;": '\U00002AC4', + "suphsol;": '\U000027C9', + "suphsub;": '\U00002AD7', + "suplarr;": '\U0000297B', + "supmult;": '\U00002AC2', + "supnE;": '\U00002ACC', + "supne;": '\U0000228B', + "supplus;": '\U00002AC0', + "supset;": '\U00002283', + "supseteq;": '\U00002287', + "supseteqq;": '\U00002AC6', + "supsetneq;": '\U0000228B', + "supsetneqq;": '\U00002ACC', + "supsim;": '\U00002AC8', + "supsub;": '\U00002AD4', + "supsup;": '\U00002AD6', + "swArr;": '\U000021D9', + "swarhk;": '\U00002926', + "swarr;": '\U00002199', + "swarrow;": '\U00002199', + "swnwar;": '\U0000292A', + "szlig;": '\U000000DF', + "target;": '\U00002316', + "tau;": '\U000003C4', + "tbrk;": '\U000023B4', + "tcaron;": '\U00000165', + "tcedil;": '\U00000163', + "tcy;": '\U00000442', + "tdot;": '\U000020DB', + "telrec;": '\U00002315', + "tfr;": '\U0001D531', + "there4;": '\U00002234', + "therefore;": '\U00002234', + "theta;": '\U000003B8', + "thetasym;": '\U000003D1', + "thetav;": '\U000003D1', + "thickapprox;": '\U00002248', + "thicksim;": '\U0000223C', + "thinsp;": '\U00002009', + "thkap;": '\U00002248', + "thksim;": '\U0000223C', + "thorn;": '\U000000FE', + "tilde;": '\U000002DC', + "times;": '\U000000D7', + "timesb;": '\U000022A0', + "timesbar;": '\U00002A31', + "timesd;": '\U00002A30', + "tint;": '\U0000222D', + "toea;": '\U00002928', + "top;": '\U000022A4', + "topbot;": '\U00002336', + "topcir;": '\U00002AF1', + "topf;": '\U0001D565', + "topfork;": '\U00002ADA', + "tosa;": '\U00002929', + "tprime;": '\U00002034', + "trade;": '\U00002122', + "triangle;": '\U000025B5', + "triangledown;": '\U000025BF', + "triangleleft;": '\U000025C3', + "trianglelefteq;": '\U000022B4', + "triangleq;": '\U0000225C', + "triangleright;": '\U000025B9', + "trianglerighteq;": '\U000022B5', + "tridot;": '\U000025EC', + "trie;": '\U0000225C', + "triminus;": '\U00002A3A', + "triplus;": '\U00002A39', + "trisb;": '\U000029CD', + "tritime;": '\U00002A3B', + "trpezium;": '\U000023E2', + "tscr;": '\U0001D4C9', + "tscy;": '\U00000446', + "tshcy;": '\U0000045B', + "tstrok;": '\U00000167', + "twixt;": '\U0000226C', + "twoheadleftarrow;": '\U0000219E', + "twoheadrightarrow;": '\U000021A0', + "uArr;": '\U000021D1', + "uHar;": '\U00002963', + "uacute;": '\U000000FA', + "uarr;": '\U00002191', + "ubrcy;": '\U0000045E', + "ubreve;": '\U0000016D', + "ucirc;": '\U000000FB', + "ucy;": '\U00000443', + "udarr;": '\U000021C5', + "udblac;": '\U00000171', + "udhar;": '\U0000296E', + "ufisht;": '\U0000297E', + "ufr;": '\U0001D532', + "ugrave;": '\U000000F9', + "uharl;": '\U000021BF', + "uharr;": '\U000021BE', + "uhblk;": '\U00002580', + "ulcorn;": '\U0000231C', + "ulcorner;": '\U0000231C', + "ulcrop;": '\U0000230F', + "ultri;": '\U000025F8', + "umacr;": '\U0000016B', + "uml;": '\U000000A8', + "uogon;": '\U00000173', + "uopf;": '\U0001D566', + "uparrow;": '\U00002191', + "updownarrow;": '\U00002195', + "upharpoonleft;": '\U000021BF', + "upharpoonright;": '\U000021BE', + "uplus;": '\U0000228E', + "upsi;": '\U000003C5', + "upsih;": '\U000003D2', + "upsilon;": '\U000003C5', + "upuparrows;": '\U000021C8', + "urcorn;": '\U0000231D', + "urcorner;": '\U0000231D', + "urcrop;": '\U0000230E', + "uring;": '\U0000016F', + "urtri;": '\U000025F9', + "uscr;": '\U0001D4CA', + "utdot;": '\U000022F0', + "utilde;": '\U00000169', + "utri;": '\U000025B5', + "utrif;": '\U000025B4', + "uuarr;": '\U000021C8', + "uuml;": '\U000000FC', + "uwangle;": '\U000029A7', + "vArr;": '\U000021D5', + "vBar;": '\U00002AE8', + "vBarv;": '\U00002AE9', + "vDash;": '\U000022A8', + "vangrt;": '\U0000299C', + "varepsilon;": '\U000003F5', + "varkappa;": '\U000003F0', + "varnothing;": '\U00002205', + "varphi;": '\U000003D5', + "varpi;": '\U000003D6', + "varpropto;": '\U0000221D', + "varr;": '\U00002195', + "varrho;": '\U000003F1', + "varsigma;": '\U000003C2', + "vartheta;": '\U000003D1', + "vartriangleleft;": '\U000022B2', + "vartriangleright;": '\U000022B3', + "vcy;": '\U00000432', + "vdash;": '\U000022A2', + "vee;": '\U00002228', + "veebar;": '\U000022BB', + "veeeq;": '\U0000225A', + "vellip;": '\U000022EE', + "verbar;": '\U0000007C', + "vert;": '\U0000007C', + "vfr;": '\U0001D533', + "vltri;": '\U000022B2', + "vopf;": '\U0001D567', + "vprop;": '\U0000221D', + "vrtri;": '\U000022B3', + "vscr;": '\U0001D4CB', + "vzigzag;": '\U0000299A', + "wcirc;": '\U00000175', + "wedbar;": '\U00002A5F', + "wedge;": '\U00002227', + "wedgeq;": '\U00002259', + "weierp;": '\U00002118', + "wfr;": '\U0001D534', + "wopf;": '\U0001D568', + "wp;": '\U00002118', + "wr;": '\U00002240', + "wreath;": '\U00002240', + "wscr;": '\U0001D4CC', + "xcap;": '\U000022C2', + "xcirc;": '\U000025EF', + "xcup;": '\U000022C3', + "xdtri;": '\U000025BD', + "xfr;": '\U0001D535', + "xhArr;": '\U000027FA', + "xharr;": '\U000027F7', + "xi;": '\U000003BE', + "xlArr;": '\U000027F8', + "xlarr;": '\U000027F5', + "xmap;": '\U000027FC', + "xnis;": '\U000022FB', + "xodot;": '\U00002A00', + "xopf;": '\U0001D569', + "xoplus;": '\U00002A01', + "xotime;": '\U00002A02', + "xrArr;": '\U000027F9', + "xrarr;": '\U000027F6', + "xscr;": '\U0001D4CD', + "xsqcup;": '\U00002A06', + "xuplus;": '\U00002A04', + "xutri;": '\U000025B3', + "xvee;": '\U000022C1', + "xwedge;": '\U000022C0', + "yacute;": '\U000000FD', + "yacy;": '\U0000044F', + "ycirc;": '\U00000177', + "ycy;": '\U0000044B', + "yen;": '\U000000A5', + "yfr;": '\U0001D536', + "yicy;": '\U00000457', + "yopf;": '\U0001D56A', + "yscr;": '\U0001D4CE', + "yucy;": '\U0000044E', + "yuml;": '\U000000FF', + "zacute;": '\U0000017A', + "zcaron;": '\U0000017E', + "zcy;": '\U00000437', + "zdot;": '\U0000017C', + "zeetrf;": '\U00002128', + "zeta;": '\U000003B6', + "zfr;": '\U0001D537', + "zhcy;": '\U00000436', + "zigrarr;": '\U000021DD', + "zopf;": '\U0001D56B', + "zscr;": '\U0001D4CF', + "zwj;": '\U0000200D', + "zwnj;": '\U0000200C', + "AElig": '\U000000C6', + "AMP": '\U00000026', + "Aacute": '\U000000C1', + "Acirc": '\U000000C2', + "Agrave": '\U000000C0', + "Aring": '\U000000C5', + "Atilde": '\U000000C3', + "Auml": '\U000000C4', + "COPY": '\U000000A9', + "Ccedil": '\U000000C7', + "ETH": '\U000000D0', + "Eacute": '\U000000C9', + "Ecirc": '\U000000CA', + "Egrave": '\U000000C8', + "Euml": '\U000000CB', + "GT": '\U0000003E', + "Iacute": '\U000000CD', + "Icirc": '\U000000CE', + "Igrave": '\U000000CC', + "Iuml": '\U000000CF', + "LT": '\U0000003C', + "Ntilde": '\U000000D1', + "Oacute": '\U000000D3', + "Ocirc": '\U000000D4', + "Ograve": '\U000000D2', + "Oslash": '\U000000D8', + "Otilde": '\U000000D5', + "Ouml": '\U000000D6', + "QUOT": '\U00000022', + "REG": '\U000000AE', + "THORN": '\U000000DE', + "Uacute": '\U000000DA', + "Ucirc": '\U000000DB', + "Ugrave": '\U000000D9', + "Uuml": '\U000000DC', + "Yacute": '\U000000DD', + "aacute": '\U000000E1', + "acirc": '\U000000E2', + "acute": '\U000000B4', + "aelig": '\U000000E6', + "agrave": '\U000000E0', + "amp": '\U00000026', + "aring": '\U000000E5', + "atilde": '\U000000E3', + "auml": '\U000000E4', + "brvbar": '\U000000A6', + "ccedil": '\U000000E7', + "cedil": '\U000000B8', + "cent": '\U000000A2', + "copy": '\U000000A9', + "curren": '\U000000A4', + "deg": '\U000000B0', + "divide": '\U000000F7', + "eacute": '\U000000E9', + "ecirc": '\U000000EA', + "egrave": '\U000000E8', + "eth": '\U000000F0', + "euml": '\U000000EB', + "frac12": '\U000000BD', + "frac14": '\U000000BC', + "frac34": '\U000000BE', + "gt": '\U0000003E', + "iacute": '\U000000ED', + "icirc": '\U000000EE', + "iexcl": '\U000000A1', + "igrave": '\U000000EC', + "iquest": '\U000000BF', + "iuml": '\U000000EF', + "laquo": '\U000000AB', + "lt": '\U0000003C', + "macr": '\U000000AF', + "micro": '\U000000B5', + "middot": '\U000000B7', + "nbsp": '\U000000A0', + "not": '\U000000AC', + "ntilde": '\U000000F1', + "oacute": '\U000000F3', + "ocirc": '\U000000F4', + "ograve": '\U000000F2', + "ordf": '\U000000AA', + "ordm": '\U000000BA', + "oslash": '\U000000F8', + "otilde": '\U000000F5', + "ouml": '\U000000F6', + "para": '\U000000B6', + "plusmn": '\U000000B1', + "pound": '\U000000A3', + "quot": '\U00000022', + "raquo": '\U000000BB', + "reg": '\U000000AE', + "sect": '\U000000A7', + "shy": '\U000000AD', + "sup1": '\U000000B9', + "sup2": '\U000000B2', + "sup3": '\U000000B3', + "szlig": '\U000000DF', + "thorn": '\U000000FE', + "times": '\U000000D7', + "uacute": '\U000000FA', + "ucirc": '\U000000FB', + "ugrave": '\U000000F9', + "uml": '\U000000A8', + "uuml": '\U000000FC', + "yacute": '\U000000FD', + "yen": '\U000000A5', + "yuml": '\U000000FF', +} + +// HTML entities that are two unicode codepoints. +var entity2 = map[string][2]rune{ + // TODO(nigeltao): Handle replacements that are wider than their names. + // "nLt;": {'\u226A', '\u20D2'}, + // "nGt;": {'\u226B', '\u20D2'}, + "NotEqualTilde;": {'\u2242', '\u0338'}, + "NotGreaterFullEqual;": {'\u2267', '\u0338'}, + "NotGreaterGreater;": {'\u226B', '\u0338'}, + "NotGreaterSlantEqual;": {'\u2A7E', '\u0338'}, + "NotHumpDownHump;": {'\u224E', '\u0338'}, + "NotHumpEqual;": {'\u224F', '\u0338'}, + "NotLeftTriangleBar;": {'\u29CF', '\u0338'}, + "NotLessLess;": {'\u226A', '\u0338'}, + "NotLessSlantEqual;": {'\u2A7D', '\u0338'}, + "NotNestedGreaterGreater;": {'\u2AA2', '\u0338'}, + "NotNestedLessLess;": {'\u2AA1', '\u0338'}, + "NotPrecedesEqual;": {'\u2AAF', '\u0338'}, + "NotRightTriangleBar;": {'\u29D0', '\u0338'}, + "NotSquareSubset;": {'\u228F', '\u0338'}, + "NotSquareSuperset;": {'\u2290', '\u0338'}, + "NotSubset;": {'\u2282', '\u20D2'}, + "NotSucceedsEqual;": {'\u2AB0', '\u0338'}, + "NotSucceedsTilde;": {'\u227F', '\u0338'}, + "NotSuperset;": {'\u2283', '\u20D2'}, + "ThickSpace;": {'\u205F', '\u200A'}, + "acE;": {'\u223E', '\u0333'}, + "bne;": {'\u003D', '\u20E5'}, + "bnequiv;": {'\u2261', '\u20E5'}, + "caps;": {'\u2229', '\uFE00'}, + "cups;": {'\u222A', '\uFE00'}, + "fjlig;": {'\u0066', '\u006A'}, + "gesl;": {'\u22DB', '\uFE00'}, + "gvertneqq;": {'\u2269', '\uFE00'}, + "gvnE;": {'\u2269', '\uFE00'}, + "lates;": {'\u2AAD', '\uFE00'}, + "lesg;": {'\u22DA', '\uFE00'}, + "lvertneqq;": {'\u2268', '\uFE00'}, + "lvnE;": {'\u2268', '\uFE00'}, + "nGg;": {'\u22D9', '\u0338'}, + "nGtv;": {'\u226B', '\u0338'}, + "nLl;": {'\u22D8', '\u0338'}, + "nLtv;": {'\u226A', '\u0338'}, + "nang;": {'\u2220', '\u20D2'}, + "napE;": {'\u2A70', '\u0338'}, + "napid;": {'\u224B', '\u0338'}, + "nbump;": {'\u224E', '\u0338'}, + "nbumpe;": {'\u224F', '\u0338'}, + "ncongdot;": {'\u2A6D', '\u0338'}, + "nedot;": {'\u2250', '\u0338'}, + "nesim;": {'\u2242', '\u0338'}, + "ngE;": {'\u2267', '\u0338'}, + "ngeqq;": {'\u2267', '\u0338'}, + "ngeqslant;": {'\u2A7E', '\u0338'}, + "nges;": {'\u2A7E', '\u0338'}, + "nlE;": {'\u2266', '\u0338'}, + "nleqq;": {'\u2266', '\u0338'}, + "nleqslant;": {'\u2A7D', '\u0338'}, + "nles;": {'\u2A7D', '\u0338'}, + "notinE;": {'\u22F9', '\u0338'}, + "notindot;": {'\u22F5', '\u0338'}, + "nparsl;": {'\u2AFD', '\u20E5'}, + "npart;": {'\u2202', '\u0338'}, + "npre;": {'\u2AAF', '\u0338'}, + "npreceq;": {'\u2AAF', '\u0338'}, + "nrarrc;": {'\u2933', '\u0338'}, + "nrarrw;": {'\u219D', '\u0338'}, + "nsce;": {'\u2AB0', '\u0338'}, + "nsubE;": {'\u2AC5', '\u0338'}, + "nsubset;": {'\u2282', '\u20D2'}, + "nsubseteqq;": {'\u2AC5', '\u0338'}, + "nsucceq;": {'\u2AB0', '\u0338'}, + "nsupE;": {'\u2AC6', '\u0338'}, + "nsupset;": {'\u2283', '\u20D2'}, + "nsupseteqq;": {'\u2AC6', '\u0338'}, + "nvap;": {'\u224D', '\u20D2'}, + "nvge;": {'\u2265', '\u20D2'}, + "nvgt;": {'\u003E', '\u20D2'}, + "nvle;": {'\u2264', '\u20D2'}, + "nvlt;": {'\u003C', '\u20D2'}, + "nvltrie;": {'\u22B4', '\u20D2'}, + "nvrtrie;": {'\u22B5', '\u20D2'}, + "nvsim;": {'\u223C', '\u20D2'}, + "race;": {'\u223D', '\u0331'}, + "smtes;": {'\u2AAC', '\uFE00'}, + "sqcaps;": {'\u2293', '\uFE00'}, + "sqcups;": {'\u2294', '\uFE00'}, + "varsubsetneq;": {'\u228A', '\uFE00'}, + "varsubsetneqq;": {'\u2ACB', '\uFE00'}, + "varsupsetneq;": {'\u228B', '\uFE00'}, + "varsupsetneqq;": {'\u2ACC', '\uFE00'}, + "vnsub;": {'\u2282', '\u20D2'}, + "vnsup;": {'\u2283', '\u20D2'}, + "vsubnE;": {'\u2ACB', '\uFE00'}, + "vsubne;": {'\u228A', '\uFE00'}, + "vsupnE;": {'\u2ACC', '\uFE00'}, + "vsupne;": {'\u228B', '\uFE00'}, +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/escape.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/escape.go new file mode 100644 index 0000000000..d856139620 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/escape.go @@ -0,0 +1,258 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "bytes" + "strings" + "unicode/utf8" +) + +// These replacements permit compatibility with old numeric entities that +// assumed Windows-1252 encoding. +// https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference +var replacementTable = [...]rune{ + '\u20AC', // First entry is what 0x80 should be replaced with. + '\u0081', + '\u201A', + '\u0192', + '\u201E', + '\u2026', + '\u2020', + '\u2021', + '\u02C6', + '\u2030', + '\u0160', + '\u2039', + '\u0152', + '\u008D', + '\u017D', + '\u008F', + '\u0090', + '\u2018', + '\u2019', + '\u201C', + '\u201D', + '\u2022', + '\u2013', + '\u2014', + '\u02DC', + '\u2122', + '\u0161', + '\u203A', + '\u0153', + '\u009D', + '\u017E', + '\u0178', // Last entry is 0x9F. + // 0x00->'\uFFFD' is handled programmatically. + // 0x0D->'\u000D' is a no-op. +} + +// unescapeEntity reads an entity like "<" from b[src:] and writes the +// corresponding "<" to b[dst:], returning the incremented dst and src cursors. +// Precondition: b[src] == '&' && dst <= src. +// attribute should be true if parsing an attribute value. +func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) { + // https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference + + // i starts at 1 because we already know that s[0] == '&'. + i, s := 1, b[src:] + + if len(s) <= 1 { + b[dst] = b[src] + return dst + 1, src + 1 + } + + if s[i] == '#' { + if len(s) <= 3 { // We need to have at least "&#.". + b[dst] = b[src] + return dst + 1, src + 1 + } + i++ + c := s[i] + hex := false + if c == 'x' || c == 'X' { + hex = true + i++ + } + + x := '\x00' + for i < len(s) { + c = s[i] + i++ + if hex { + if '0' <= c && c <= '9' { + x = 16*x + rune(c) - '0' + continue + } else if 'a' <= c && c <= 'f' { + x = 16*x + rune(c) - 'a' + 10 + continue + } else if 'A' <= c && c <= 'F' { + x = 16*x + rune(c) - 'A' + 10 + continue + } + } else if '0' <= c && c <= '9' { + x = 10*x + rune(c) - '0' + continue + } + if c != ';' { + i-- + } + break + } + + if i <= 3 { // No characters matched. + b[dst] = b[src] + return dst + 1, src + 1 + } + + if 0x80 <= x && x <= 0x9F { + // Replace characters from Windows-1252 with UTF-8 equivalents. + x = replacementTable[x-0x80] + } else if x == 0 || (0xD800 <= x && x <= 0xDFFF) || x > 0x10FFFF { + // Replace invalid characters with the replacement character. + x = '\uFFFD' + } + + return dst + utf8.EncodeRune(b[dst:], x), src + i + } + + // Consume the maximum number of characters possible, with the + // consumed characters matching one of the named references. + + for i < len(s) { + c := s[i] + i++ + // Lower-cased characters are more common in entities, so we check for them first. + if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9' { + continue + } + if c != ';' { + i-- + } + break + } + + entityName := string(s[1:i]) + if entityName == "" { + // No-op. + } else if attribute && entityName[len(entityName)-1] != ';' && len(s) > i && s[i] == '=' { + // No-op. + } else if x := entity[entityName]; x != 0 { + return dst + utf8.EncodeRune(b[dst:], x), src + i + } else if x := entity2[entityName]; x[0] != 0 { + dst1 := dst + utf8.EncodeRune(b[dst:], x[0]) + return dst1 + utf8.EncodeRune(b[dst1:], x[1]), src + i + } else if !attribute { + maxLen := len(entityName) - 1 + if maxLen > longestEntityWithoutSemicolon { + maxLen = longestEntityWithoutSemicolon + } + for j := maxLen; j > 1; j-- { + if x := entity[entityName[:j]]; x != 0 { + return dst + utf8.EncodeRune(b[dst:], x), src + j + 1 + } + } + } + + dst1, src1 = dst+i, src+i + copy(b[dst:dst1], b[src:src1]) + return dst1, src1 +} + +// unescape unescapes b's entities in-place, so that "a<b" becomes "a': + esc = ">" + case '"': + // """ is shorter than """. + esc = """ + case '\r': + esc = " " + default: + panic("unrecognized escape character") + } + s = s[i+1:] + if _, err := w.WriteString(esc); err != nil { + return err + } + i = strings.IndexAny(s, escapedChars) + } + _, err := w.WriteString(s) + return err +} + +// EscapeString escapes special characters like "<" to become "<". It +// escapes only five such characters: <, >, &, ' and ". +// UnescapeString(EscapeString(s)) == s always holds, but the converse isn't +// always true. +func EscapeString(s string) string { + if strings.IndexAny(s, escapedChars) == -1 { + return s + } + var buf bytes.Buffer + escape(&buf, s) + return buf.String() +} + +// UnescapeString unescapes entities like "<" to become "<". It unescapes a +// larger range of entities than EscapeString escapes. For example, "á" +// unescapes to "á", as does "á" and "&xE1;". +// UnescapeString(EscapeString(s)) == s always holds, but the converse isn't +// always true. +func UnescapeString(s string) string { + for _, c := range s { + if c == '&' { + return string(unescape([]byte(s), false)) + } + } + return s +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/foreign.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/foreign.go new file mode 100644 index 0000000000..d3b3844099 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/foreign.go @@ -0,0 +1,226 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "strings" +) + +func adjustAttributeNames(aa []Attribute, nameMap map[string]string) { + for i := range aa { + if newName, ok := nameMap[aa[i].Key]; ok { + aa[i].Key = newName + } + } +} + +func adjustForeignAttributes(aa []Attribute) { + for i, a := range aa { + if a.Key == "" || a.Key[0] != 'x' { + continue + } + switch a.Key { + case "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", + "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space", "xmlns:xlink": + j := strings.Index(a.Key, ":") + aa[i].Namespace = a.Key[:j] + aa[i].Key = a.Key[j+1:] + } + } +} + +func htmlIntegrationPoint(n *Node) bool { + if n.Type != ElementNode { + return false + } + switch n.Namespace { + case "math": + if n.Data == "annotation-xml" { + for _, a := range n.Attr { + if a.Key == "encoding" { + val := strings.ToLower(a.Val) + if val == "text/html" || val == "application/xhtml+xml" { + return true + } + } + } + } + case "svg": + switch n.Data { + case "desc", "foreignObject", "title": + return true + } + } + return false +} + +func mathMLTextIntegrationPoint(n *Node) bool { + if n.Namespace != "math" { + return false + } + switch n.Data { + case "mi", "mo", "mn", "ms", "mtext": + return true + } + return false +} + +// Section 12.2.5.5. +var breakout = map[string]bool{ + "b": true, + "big": true, + "blockquote": true, + "body": true, + "br": true, + "center": true, + "code": true, + "dd": true, + "div": true, + "dl": true, + "dt": true, + "em": true, + "embed": true, + "h1": true, + "h2": true, + "h3": true, + "h4": true, + "h5": true, + "h6": true, + "head": true, + "hr": true, + "i": true, + "img": true, + "li": true, + "listing": true, + "menu": true, + "meta": true, + "nobr": true, + "ol": true, + "p": true, + "pre": true, + "ruby": true, + "s": true, + "small": true, + "span": true, + "strong": true, + "strike": true, + "sub": true, + "sup": true, + "table": true, + "tt": true, + "u": true, + "ul": true, + "var": true, +} + +// Section 12.2.5.5. +var svgTagNameAdjustments = map[string]string{ + "altglyph": "altGlyph", + "altglyphdef": "altGlyphDef", + "altglyphitem": "altGlyphItem", + "animatecolor": "animateColor", + "animatemotion": "animateMotion", + "animatetransform": "animateTransform", + "clippath": "clipPath", + "feblend": "feBlend", + "fecolormatrix": "feColorMatrix", + "fecomponenttransfer": "feComponentTransfer", + "fecomposite": "feComposite", + "feconvolvematrix": "feConvolveMatrix", + "fediffuselighting": "feDiffuseLighting", + "fedisplacementmap": "feDisplacementMap", + "fedistantlight": "feDistantLight", + "feflood": "feFlood", + "fefunca": "feFuncA", + "fefuncb": "feFuncB", + "fefuncg": "feFuncG", + "fefuncr": "feFuncR", + "fegaussianblur": "feGaussianBlur", + "feimage": "feImage", + "femerge": "feMerge", + "femergenode": "feMergeNode", + "femorphology": "feMorphology", + "feoffset": "feOffset", + "fepointlight": "fePointLight", + "fespecularlighting": "feSpecularLighting", + "fespotlight": "feSpotLight", + "fetile": "feTile", + "feturbulence": "feTurbulence", + "foreignobject": "foreignObject", + "glyphref": "glyphRef", + "lineargradient": "linearGradient", + "radialgradient": "radialGradient", + "textpath": "textPath", +} + +// Section 12.2.5.1 +var mathMLAttributeAdjustments = map[string]string{ + "definitionurl": "definitionURL", +} + +var svgAttributeAdjustments = map[string]string{ + "attributename": "attributeName", + "attributetype": "attributeType", + "basefrequency": "baseFrequency", + "baseprofile": "baseProfile", + "calcmode": "calcMode", + "clippathunits": "clipPathUnits", + "contentscripttype": "contentScriptType", + "contentstyletype": "contentStyleType", + "diffuseconstant": "diffuseConstant", + "edgemode": "edgeMode", + "externalresourcesrequired": "externalResourcesRequired", + "filterres": "filterRes", + "filterunits": "filterUnits", + "glyphref": "glyphRef", + "gradienttransform": "gradientTransform", + "gradientunits": "gradientUnits", + "kernelmatrix": "kernelMatrix", + "kernelunitlength": "kernelUnitLength", + "keypoints": "keyPoints", + "keysplines": "keySplines", + "keytimes": "keyTimes", + "lengthadjust": "lengthAdjust", + "limitingconeangle": "limitingConeAngle", + "markerheight": "markerHeight", + "markerunits": "markerUnits", + "markerwidth": "markerWidth", + "maskcontentunits": "maskContentUnits", + "maskunits": "maskUnits", + "numoctaves": "numOctaves", + "pathlength": "pathLength", + "patterncontentunits": "patternContentUnits", + "patterntransform": "patternTransform", + "patternunits": "patternUnits", + "pointsatx": "pointsAtX", + "pointsaty": "pointsAtY", + "pointsatz": "pointsAtZ", + "preservealpha": "preserveAlpha", + "preserveaspectratio": "preserveAspectRatio", + "primitiveunits": "primitiveUnits", + "refx": "refX", + "refy": "refY", + "repeatcount": "repeatCount", + "repeatdur": "repeatDur", + "requiredextensions": "requiredExtensions", + "requiredfeatures": "requiredFeatures", + "specularconstant": "specularConstant", + "specularexponent": "specularExponent", + "spreadmethod": "spreadMethod", + "startoffset": "startOffset", + "stddeviation": "stdDeviation", + "stitchtiles": "stitchTiles", + "surfacescale": "surfaceScale", + "systemlanguage": "systemLanguage", + "tablevalues": "tableValues", + "targetx": "targetX", + "targety": "targetY", + "textlength": "textLength", + "viewbox": "viewBox", + "viewtarget": "viewTarget", + "xchannelselector": "xChannelSelector", + "ychannelselector": "yChannelSelector", + "zoomandpan": "zoomAndPan", +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/node.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/node.go new file mode 100644 index 0000000000..26b657aec8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/node.go @@ -0,0 +1,193 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "golang.org/x/net/html/atom" +) + +// A NodeType is the type of a Node. +type NodeType uint32 + +const ( + ErrorNode NodeType = iota + TextNode + DocumentNode + ElementNode + CommentNode + DoctypeNode + scopeMarkerNode +) + +// Section 12.2.3.3 says "scope markers are inserted when entering applet +// elements, buttons, object elements, marquees, table cells, and table +// captions, and are used to prevent formatting from 'leaking'". +var scopeMarker = Node{Type: scopeMarkerNode} + +// A Node consists of a NodeType and some Data (tag name for element nodes, +// content for text) and are part of a tree of Nodes. Element nodes may also +// have a Namespace and contain a slice of Attributes. Data is unescaped, so +// that it looks like "a 0 { + return (*s)[i-1] + } + return nil +} + +// index returns the index of the top-most occurrence of n in the stack, or -1 +// if n is not present. +func (s *nodeStack) index(n *Node) int { + for i := len(*s) - 1; i >= 0; i-- { + if (*s)[i] == n { + return i + } + } + return -1 +} + +// insert inserts a node at the given index. +func (s *nodeStack) insert(i int, n *Node) { + (*s) = append(*s, nil) + copy((*s)[i+1:], (*s)[i:]) + (*s)[i] = n +} + +// remove removes a node from the stack. It is a no-op if n is not present. +func (s *nodeStack) remove(n *Node) { + i := s.index(n) + if i == -1 { + return + } + copy((*s)[i:], (*s)[i+1:]) + j := len(*s) - 1 + (*s)[j] = nil + *s = (*s)[:j] +} diff --git a/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/parse.go b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/parse.go new file mode 100644 index 0000000000..be4b2bf5aa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/vendor/golang.org/x/net/html/parse.go @@ -0,0 +1,2094 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "errors" + "fmt" + "io" + "strings" + + a "golang.org/x/net/html/atom" +) + +// A parser implements the HTML5 parsing algorithm: +// https://html.spec.whatwg.org/multipage/syntax.html#tree-construction +type parser struct { + // tokenizer provides the tokens for the parser. + tokenizer *Tokenizer + // tok is the most recently read token. + tok Token + // Self-closing tags like
are treated as start tags, except that + // hasSelfClosingToken is set while they are being processed. + hasSelfClosingToken bool + // doc is the document root element. + doc *Node + // The stack of open elements (section 12.2.3.2) and active formatting + // elements (section 12.2.3.3). + oe, afe nodeStack + // Element pointers (section 12.2.3.4). + head, form *Node + // Other parsing state flags (section 12.2.3.5). + scripting, framesetOK bool + // im is the current insertion mode. + im insertionMode + // originalIM is the insertion mode to go back to after completing a text + // or inTableText insertion mode. + originalIM insertionMode + // fosterParenting is whether new elements should be inserted according to + // the foster parenting rules (section 12.2.5.3). + fosterParenting bool + // quirks is whether the parser is operating in "quirks mode." + quirks bool + // fragment is whether the parser is parsing an HTML fragment. + fragment bool + // context is the context element when parsing an HTML fragment + // (section 12.4). + context *Node +} + +func (p *parser) top() *Node { + if n := p.oe.top(); n != nil { + return n + } + return p.doc +} + +// Stop tags for use in popUntil. These come from section 12.2.3.2. +var ( + defaultScopeStopTags = map[string][]a.Atom{ + "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template}, + "math": {a.AnnotationXml, a.Mi, a.Mn, a.Mo, a.Ms, a.Mtext}, + "svg": {a.Desc, a.ForeignObject, a.Title}, + } +) + +type scope int + +const ( + defaultScope scope = iota + listItemScope + buttonScope + tableScope + tableRowScope + tableBodyScope + selectScope +) + +// popUntil pops the stack of open elements at the highest element whose tag +// is in matchTags, provided there is no higher element in the scope's stop +// tags (as defined in section 12.2.3.2). It returns whether or not there was +// such an element. If there was not, popUntil leaves the stack unchanged. +// +// For example, the set of stop tags for table scope is: "html", "table". If +// the stack was: +// ["html", "body", "font", "table", "b", "i", "u"] +// then popUntil(tableScope, "font") would return false, but +// popUntil(tableScope, "i") would return true and the stack would become: +// ["html", "body", "font", "table", "b"] +// +// If an element's tag is in both the stop tags and matchTags, then the stack +// will be popped and the function returns true (provided, of course, there was +// no higher element in the stack that was also in the stop tags). For example, +// popUntil(tableScope, "table") returns true and leaves: +// ["html", "body", "font"] +func (p *parser) popUntil(s scope, matchTags ...a.Atom) bool { + if i := p.indexOfElementInScope(s, matchTags...); i != -1 { + p.oe = p.oe[:i] + return true + } + return false +} + +// indexOfElementInScope returns the index in p.oe of the highest element whose +// tag is in matchTags that is in scope. If no matching element is in scope, it +// returns -1. +func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { + for i := len(p.oe) - 1; i >= 0; i-- { + tagAtom := p.oe[i].DataAtom + if p.oe[i].Namespace == "" { + for _, t := range matchTags { + if t == tagAtom { + return i + } + } + switch s { + case defaultScope: + // No-op. + case listItemScope: + if tagAtom == a.Ol || tagAtom == a.Ul { + return -1 + } + case buttonScope: + if tagAtom == a.Button { + return -1 + } + case tableScope: + if tagAtom == a.Html || tagAtom == a.Table { + return -1 + } + case selectScope: + if tagAtom != a.Optgroup && tagAtom != a.Option { + return -1 + } + default: + panic("unreachable") + } + } + switch s { + case defaultScope, listItemScope, buttonScope: + for _, t := range defaultScopeStopTags[p.oe[i].Namespace] { + if t == tagAtom { + return -1 + } + } + } + } + return -1 +} + +// elementInScope is like popUntil, except that it doesn't modify the stack of +// open elements. +func (p *parser) elementInScope(s scope, matchTags ...a.Atom) bool { + return p.indexOfElementInScope(s, matchTags...) != -1 +} + +// clearStackToContext pops elements off the stack of open elements until a +// scope-defined element is found. +func (p *parser) clearStackToContext(s scope) { + for i := len(p.oe) - 1; i >= 0; i-- { + tagAtom := p.oe[i].DataAtom + switch s { + case tableScope: + if tagAtom == a.Html || tagAtom == a.Table { + p.oe = p.oe[:i+1] + return + } + case tableRowScope: + if tagAtom == a.Html || tagAtom == a.Tr { + p.oe = p.oe[:i+1] + return + } + case tableBodyScope: + if tagAtom == a.Html || tagAtom == a.Tbody || tagAtom == a.Tfoot || tagAtom == a.Thead { + p.oe = p.oe[:i+1] + return + } + default: + panic("unreachable") + } + } +} + +// generateImpliedEndTags pops nodes off the stack of open elements as long as +// the top node has a tag name of dd, dt, li, option, optgroup, p, rp, or rt. +// If exceptions are specified, nodes with that name will not be popped off. +func (p *parser) generateImpliedEndTags(exceptions ...string) { + var i int +loop: + for i = len(p.oe) - 1; i >= 0; i-- { + n := p.oe[i] + if n.Type == ElementNode { + switch n.DataAtom { + case a.Dd, a.Dt, a.Li, a.Option, a.Optgroup, a.P, a.Rp, a.Rt: + for _, except := range exceptions { + if n.Data == except { + break loop + } + } + continue + } + } + break + } + + p.oe = p.oe[:i+1] +} + +// addChild adds a child node n to the top element, and pushes n onto the stack +// of open elements if it is an element node. +func (p *parser) addChild(n *Node) { + if p.shouldFosterParent() { + p.fosterParent(n) + } else { + p.top().AppendChild(n) + } + + if n.Type == ElementNode { + p.oe = append(p.oe, n) + } +} + +// shouldFosterParent returns whether the next node to be added should be +// foster parented. +func (p *parser) shouldFosterParent() bool { + if p.fosterParenting { + switch p.top().DataAtom { + case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr: + return true + } + } + return false +} + +// fosterParent adds a child node according to the foster parenting rules. +// Section 12.2.5.3, "foster parenting". +func (p *parser) fosterParent(n *Node) { + var table, parent, prev *Node + var i int + for i = len(p.oe) - 1; i >= 0; i-- { + if p.oe[i].DataAtom == a.Table { + table = p.oe[i] + break + } + } + + if table == nil { + // The foster parent is the html element. + parent = p.oe[0] + } else { + parent = table.Parent + } + if parent == nil { + parent = p.oe[i-1] + } + + if table != nil { + prev = table.PrevSibling + } else { + prev = parent.LastChild + } + if prev != nil && prev.Type == TextNode && n.Type == TextNode { + prev.Data += n.Data + return + } + + parent.InsertBefore(n, table) +} + +// addText adds text to the preceding node if it is a text node, or else it +// calls addChild with a new text node. +func (p *parser) addText(text string) { + if text == "" { + return + } + + if p.shouldFosterParent() { + p.fosterParent(&Node{ + Type: TextNode, + Data: text, + }) + return + } + + t := p.top() + if n := t.LastChild; n != nil && n.Type == TextNode { + n.Data += text + return + } + p.addChild(&Node{ + Type: TextNode, + Data: text, + }) +} + +// addElement adds a child element based on the current token. +func (p *parser) addElement() { + p.addChild(&Node{ + Type: ElementNode, + DataAtom: p.tok.DataAtom, + Data: p.tok.Data, + Attr: p.tok.Attr, + }) +} + +// Section 12.2.3.3. +func (p *parser) addFormattingElement() { + tagAtom, attr := p.tok.DataAtom, p.tok.Attr + p.addElement() + + // Implement the Noah's Ark clause, but with three per family instead of two. + identicalElements := 0 +findIdenticalElements: + for i := len(p.afe) - 1; i >= 0; i-- { + n := p.afe[i] + if n.Type == scopeMarkerNode { + break + } + if n.Type != ElementNode { + continue + } + if n.Namespace != "" { + continue + } + if n.DataAtom != tagAtom { + continue + } + if len(n.Attr) != len(attr) { + continue + } + compareAttributes: + for _, t0 := range n.Attr { + for _, t1 := range attr { + if t0.Key == t1.Key && t0.Namespace == t1.Namespace && t0.Val == t1.Val { + // Found a match for this attribute, continue with the next attribute. + continue compareAttributes + } + } + // If we get here, there is no attribute that matches a. + // Therefore the element is not identical to the new one. + continue findIdenticalElements + } + + identicalElements++ + if identicalElements >= 3 { + p.afe.remove(n) + } + } + + p.afe = append(p.afe, p.top()) +} + +// Section 12.2.3.3. +func (p *parser) clearActiveFormattingElements() { + for { + n := p.afe.pop() + if len(p.afe) == 0 || n.Type == scopeMarkerNode { + return + } + } +} + +// Section 12.2.3.3. +func (p *parser) reconstructActiveFormattingElements() { + n := p.afe.top() + if n == nil { + return + } + if n.Type == scopeMarkerNode || p.oe.index(n) != -1 { + return + } + i := len(p.afe) - 1 + for n.Type != scopeMarkerNode && p.oe.index(n) == -1 { + if i == 0 { + i = -1 + break + } + i-- + n = p.afe[i] + } + for { + i++ + clone := p.afe[i].clone() + p.addChild(clone) + p.afe[i] = clone + if i == len(p.afe)-1 { + break + } + } +} + +// Section 12.2.4. +func (p *parser) acknowledgeSelfClosingTag() { + p.hasSelfClosingToken = false +} + +// An insertion mode (section 12.2.3.1) is the state transition function from +// a particular state in the HTML5 parser's state machine. It updates the +// parser's fields depending on parser.tok (where ErrorToken means EOF). +// It returns whether the token was consumed. +type insertionMode func(*parser) bool + +// setOriginalIM sets the insertion mode to return to after completing a text or +// inTableText insertion mode. +// Section 12.2.3.1, "using the rules for". +func (p *parser) setOriginalIM() { + if p.originalIM != nil { + panic("html: bad parser state: originalIM was set twice") + } + p.originalIM = p.im +} + +// Section 12.2.3.1, "reset the insertion mode". +func (p *parser) resetInsertionMode() { + for i := len(p.oe) - 1; i >= 0; i-- { + n := p.oe[i] + if i == 0 && p.context != nil { + n = p.context + } + + switch n.DataAtom { + case a.Select: + p.im = inSelectIM + case a.Td, a.Th: + p.im = inCellIM + case a.Tr: + p.im = inRowIM + case a.Tbody, a.Thead, a.Tfoot: + p.im = inTableBodyIM + case a.Caption: + p.im = inCaptionIM + case a.Colgroup: + p.im = inColumnGroupIM + case a.Table: + p.im = inTableIM + case a.Head: + p.im = inBodyIM + case a.Body: + p.im = inBodyIM + case a.Frameset: + p.im = inFramesetIM + case a.Html: + p.im = beforeHeadIM + default: + continue + } + return + } + p.im = inBodyIM +} + +const whitespace = " \t\r\n\f" + +// Section 12.2.5.4.1. +func initialIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) + if len(p.tok.Data) == 0 { + // It was all whitespace, so ignore it. + return true + } + case CommentToken: + p.doc.AppendChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + case DoctypeToken: + n, quirks := parseDoctype(p.tok.Data) + p.doc.AppendChild(n) + p.quirks = quirks + p.im = beforeHTMLIM + return true + } + p.quirks = true + p.im = beforeHTMLIM + return false +} + +// Section 12.2.5.4.2. +func beforeHTMLIM(p *parser) bool { + switch p.tok.Type { + case DoctypeToken: + // Ignore the token. + return true + case TextToken: + p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) + if len(p.tok.Data) == 0 { + // It was all whitespace, so ignore it. + return true + } + case StartTagToken: + if p.tok.DataAtom == a.Html { + p.addElement() + p.im = beforeHeadIM + return true + } + case EndTagToken: + switch p.tok.DataAtom { + case a.Head, a.Body, a.Html, a.Br: + p.parseImpliedToken(StartTagToken, a.Html, a.Html.String()) + return false + default: + // Ignore the token. + return true + } + case CommentToken: + p.doc.AppendChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + } + p.parseImpliedToken(StartTagToken, a.Html, a.Html.String()) + return false +} + +// Section 12.2.5.4.3. +func beforeHeadIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) + if len(p.tok.Data) == 0 { + // It was all whitespace, so ignore it. + return true + } + case StartTagToken: + switch p.tok.DataAtom { + case a.Head: + p.addElement() + p.head = p.top() + p.im = inHeadIM + return true + case a.Html: + return inBodyIM(p) + } + case EndTagToken: + switch p.tok.DataAtom { + case a.Head, a.Body, a.Html, a.Br: + p.parseImpliedToken(StartTagToken, a.Head, a.Head.String()) + return false + default: + // Ignore the token. + return true + } + case CommentToken: + p.addChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + case DoctypeToken: + // Ignore the token. + return true + } + + p.parseImpliedToken(StartTagToken, a.Head, a.Head.String()) + return false +} + +// Section 12.2.5.4.4. +func inHeadIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + s := strings.TrimLeft(p.tok.Data, whitespace) + if len(s) < len(p.tok.Data) { + // Add the initial whitespace to the current node. + p.addText(p.tok.Data[:len(p.tok.Data)-len(s)]) + if s == "" { + return true + } + p.tok.Data = s + } + case StartTagToken: + switch p.tok.DataAtom { + case a.Html: + return inBodyIM(p) + case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta: + p.addElement() + p.oe.pop() + p.acknowledgeSelfClosingTag() + return true + case a.Script, a.Title, a.Noscript, a.Noframes, a.Style: + p.addElement() + p.setOriginalIM() + p.im = textIM + return true + case a.Head: + // Ignore the token. + return true + } + case EndTagToken: + switch p.tok.DataAtom { + case a.Head: + n := p.oe.pop() + if n.DataAtom != a.Head { + panic("html: bad parser state: element not found, in the in-head insertion mode") + } + p.im = afterHeadIM + return true + case a.Body, a.Html, a.Br: + p.parseImpliedToken(EndTagToken, a.Head, a.Head.String()) + return false + default: + // Ignore the token. + return true + } + case CommentToken: + p.addChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + case DoctypeToken: + // Ignore the token. + return true + } + + p.parseImpliedToken(EndTagToken, a.Head, a.Head.String()) + return false +} + +// Section 12.2.5.4.6. +func afterHeadIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + s := strings.TrimLeft(p.tok.Data, whitespace) + if len(s) < len(p.tok.Data) { + // Add the initial whitespace to the current node. + p.addText(p.tok.Data[:len(p.tok.Data)-len(s)]) + if s == "" { + return true + } + p.tok.Data = s + } + case StartTagToken: + switch p.tok.DataAtom { + case a.Html: + return inBodyIM(p) + case a.Body: + p.addElement() + p.framesetOK = false + p.im = inBodyIM + return true + case a.Frameset: + p.addElement() + p.im = inFramesetIM + return true + case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title: + p.oe = append(p.oe, p.head) + defer p.oe.remove(p.head) + return inHeadIM(p) + case a.Head: + // Ignore the token. + return true + } + case EndTagToken: + switch p.tok.DataAtom { + case a.Body, a.Html, a.Br: + // Drop down to creating an implied tag. + default: + // Ignore the token. + return true + } + case CommentToken: + p.addChild(&Node{ + Type: CommentNode, + Data: p.tok.Data, + }) + return true + case DoctypeToken: + // Ignore the token. + return true + } + + p.parseImpliedToken(StartTagToken, a.Body, a.Body.String()) + p.framesetOK = true + return false +} + +// copyAttributes copies attributes of src not found on dst to dst. +func copyAttributes(dst *Node, src Token) { + if len(src.Attr) == 0 { + return + } + attr := map[string]string{} + for _, t := range dst.Attr { + attr[t.Key] = t.Val + } + for _, t := range src.Attr { + if _, ok := attr[t.Key]; !ok { + dst.Attr = append(dst.Attr, t) + attr[t.Key] = t.Val + } + } +} + +// Section 12.2.5.4.7. +func inBodyIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + d := p.tok.Data + switch n := p.oe.top(); n.DataAtom { + case a.Pre, a.Listing: + if n.FirstChild == nil { + // Ignore a newline at the start of a
 block.
+				if d != "" && d[0] == '\r' {
+					d = d[1:]
+				}
+				if d != "" && d[0] == '\n' {
+					d = d[1:]
+				}
+			}
+		}
+		d = strings.Replace(d, "\x00", "", -1)
+		if d == "" {
+			return true
+		}
+		p.reconstructActiveFormattingElements()
+		p.addText(d)
+		if p.framesetOK && strings.TrimLeft(d, whitespace) != "" {
+			// There were non-whitespace characters inserted.
+			p.framesetOK = false
+		}
+	case StartTagToken:
+		switch p.tok.DataAtom {
+		case a.Html:
+			copyAttributes(p.oe[0], p.tok)
+		case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title:
+			return inHeadIM(p)
+		case a.Body:
+			if len(p.oe) >= 2 {
+				body := p.oe[1]
+				if body.Type == ElementNode && body.DataAtom == a.Body {
+					p.framesetOK = false
+					copyAttributes(body, p.tok)
+				}
+			}
+		case a.Frameset:
+			if !p.framesetOK || len(p.oe) < 2 || p.oe[1].DataAtom != a.Body {
+				// Ignore the token.
+				return true
+			}
+			body := p.oe[1]
+			if body.Parent != nil {
+				body.Parent.RemoveChild(body)
+			}
+			p.oe = p.oe[:1]
+			p.addElement()
+			p.im = inFramesetIM
+			return true
+		case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul:
+			p.popUntil(buttonScope, a.P)
+			p.addElement()
+		case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
+			p.popUntil(buttonScope, a.P)
+			switch n := p.top(); n.DataAtom {
+			case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
+				p.oe.pop()
+			}
+			p.addElement()
+		case a.Pre, a.Listing:
+			p.popUntil(buttonScope, a.P)
+			p.addElement()
+			// The newline, if any, will be dealt with by the TextToken case.
+			p.framesetOK = false
+		case a.Form:
+			if p.form == nil {
+				p.popUntil(buttonScope, a.P)
+				p.addElement()
+				p.form = p.top()
+			}
+		case a.Li:
+			p.framesetOK = false
+			for i := len(p.oe) - 1; i >= 0; i-- {
+				node := p.oe[i]
+				switch node.DataAtom {
+				case a.Li:
+					p.oe = p.oe[:i]
+				case a.Address, a.Div, a.P:
+					continue
+				default:
+					if !isSpecialElement(node) {
+						continue
+					}
+				}
+				break
+			}
+			p.popUntil(buttonScope, a.P)
+			p.addElement()
+		case a.Dd, a.Dt:
+			p.framesetOK = false
+			for i := len(p.oe) - 1; i >= 0; i-- {
+				node := p.oe[i]
+				switch node.DataAtom {
+				case a.Dd, a.Dt:
+					p.oe = p.oe[:i]
+				case a.Address, a.Div, a.P:
+					continue
+				default:
+					if !isSpecialElement(node) {
+						continue
+					}
+				}
+				break
+			}
+			p.popUntil(buttonScope, a.P)
+			p.addElement()
+		case a.Plaintext:
+			p.popUntil(buttonScope, a.P)
+			p.addElement()
+		case a.Button:
+			p.popUntil(defaultScope, a.Button)
+			p.reconstructActiveFormattingElements()
+			p.addElement()
+			p.framesetOK = false
+		case a.A:
+			for i := len(p.afe) - 1; i >= 0 && p.afe[i].Type != scopeMarkerNode; i-- {
+				if n := p.afe[i]; n.Type == ElementNode && n.DataAtom == a.A {
+					p.inBodyEndTagFormatting(a.A)
+					p.oe.remove(n)
+					p.afe.remove(n)
+					break
+				}
+			}
+			p.reconstructActiveFormattingElements()
+			p.addFormattingElement()
+		case a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U:
+			p.reconstructActiveFormattingElements()
+			p.addFormattingElement()
+		case a.Nobr:
+			p.reconstructActiveFormattingElements()
+			if p.elementInScope(defaultScope, a.Nobr) {
+				p.inBodyEndTagFormatting(a.Nobr)
+				p.reconstructActiveFormattingElements()
+			}
+			p.addFormattingElement()
+		case a.Applet, a.Marquee, a.Object:
+			p.reconstructActiveFormattingElements()
+			p.addElement()
+			p.afe = append(p.afe, &scopeMarker)
+			p.framesetOK = false
+		case a.Table:
+			if !p.quirks {
+				p.popUntil(buttonScope, a.P)
+			}
+			p.addElement()
+			p.framesetOK = false
+			p.im = inTableIM
+			return true
+		case a.Area, a.Br, a.Embed, a.Img, a.Input, a.Keygen, a.Wbr:
+			p.reconstructActiveFormattingElements()
+			p.addElement()
+			p.oe.pop()
+			p.acknowledgeSelfClosingTag()
+			if p.tok.DataAtom == a.Input {
+				for _, t := range p.tok.Attr {
+					if t.Key == "type" {
+						if strings.ToLower(t.Val) == "hidden" {
+							// Skip setting framesetOK = false
+							return true
+						}
+					}
+				}
+			}
+			p.framesetOK = false
+		case a.Param, a.Source, a.Track:
+			p.addElement()
+			p.oe.pop()
+			p.acknowledgeSelfClosingTag()
+		case a.Hr:
+			p.popUntil(buttonScope, a.P)
+			p.addElement()
+			p.oe.pop()
+			p.acknowledgeSelfClosingTag()
+			p.framesetOK = false
+		case a.Image:
+			p.tok.DataAtom = a.Img
+			p.tok.Data = a.Img.String()
+			return false
+		case a.Isindex:
+			if p.form != nil {
+				// Ignore the token.
+				return true
+			}
+			action := ""
+			prompt := "This is a searchable index. Enter search keywords: "
+			attr := []Attribute{{Key: "name", Val: "isindex"}}
+			for _, t := range p.tok.Attr {
+				switch t.Key {
+				case "action":
+					action = t.Val
+				case "name":
+					// Ignore the attribute.
+				case "prompt":
+					prompt = t.Val
+				default:
+					attr = append(attr, t)
+				}
+			}
+			p.acknowledgeSelfClosingTag()
+			p.popUntil(buttonScope, a.P)
+			p.parseImpliedToken(StartTagToken, a.Form, a.Form.String())
+			if action != "" {
+				p.form.Attr = []Attribute{{Key: "action", Val: action}}
+			}
+			p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String())
+			p.parseImpliedToken(StartTagToken, a.Label, a.Label.String())
+			p.addText(prompt)
+			p.addChild(&Node{
+				Type:     ElementNode,
+				DataAtom: a.Input,
+				Data:     a.Input.String(),
+				Attr:     attr,
+			})
+			p.oe.pop()
+			p.parseImpliedToken(EndTagToken, a.Label, a.Label.String())
+			p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String())
+			p.parseImpliedToken(EndTagToken, a.Form, a.Form.String())
+		case a.Textarea:
+			p.addElement()
+			p.setOriginalIM()
+			p.framesetOK = false
+			p.im = textIM
+		case a.Xmp:
+			p.popUntil(buttonScope, a.P)
+			p.reconstructActiveFormattingElements()
+			p.framesetOK = false
+			p.addElement()
+			p.setOriginalIM()
+			p.im = textIM
+		case a.Iframe:
+			p.framesetOK = false
+			p.addElement()
+			p.setOriginalIM()
+			p.im = textIM
+		case a.Noembed, a.Noscript:
+			p.addElement()
+			p.setOriginalIM()
+			p.im = textIM
+		case a.Select:
+			p.reconstructActiveFormattingElements()
+			p.addElement()
+			p.framesetOK = false
+			p.im = inSelectIM
+			return true
+		case a.Optgroup, a.Option:
+			if p.top().DataAtom == a.Option {
+				p.oe.pop()
+			}
+			p.reconstructActiveFormattingElements()
+			p.addElement()
+		case a.Rp, a.Rt:
+			if p.elementInScope(defaultScope, a.Ruby) {
+				p.generateImpliedEndTags()
+			}
+			p.addElement()
+		case a.Math, a.Svg:
+			p.reconstructActiveFormattingElements()
+			if p.tok.DataAtom == a.Math {
+				adjustAttributeNames(p.tok.Attr, mathMLAttributeAdjustments)
+			} else {
+				adjustAttributeNames(p.tok.Attr, svgAttributeAdjustments)
+			}
+			adjustForeignAttributes(p.tok.Attr)
+			p.addElement()
+			p.top().Namespace = p.tok.Data
+			if p.hasSelfClosingToken {
+				p.oe.pop()
+				p.acknowledgeSelfClosingTag()
+			}
+			return true
+		case a.Caption, a.Col, a.Colgroup, a.Frame, a.Head, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
+			// Ignore the token.
+		default:
+			p.reconstructActiveFormattingElements()
+			p.addElement()
+		}
+	case EndTagToken:
+		switch p.tok.DataAtom {
+		case a.Body:
+			if p.elementInScope(defaultScope, a.Body) {
+				p.im = afterBodyIM
+			}
+		case a.Html:
+			if p.elementInScope(defaultScope, a.Body) {
+				p.parseImpliedToken(EndTagToken, a.Body, a.Body.String())
+				return false
+			}
+			return true
+		case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul:
+			p.popUntil(defaultScope, p.tok.DataAtom)
+		case a.Form:
+			node := p.form
+			p.form = nil
+			i := p.indexOfElementInScope(defaultScope, a.Form)
+			if node == nil || i == -1 || p.oe[i] != node {
+				// Ignore the token.
+				return true
+			}
+			p.generateImpliedEndTags()
+			p.oe.remove(node)
+		case a.P:
+			if !p.elementInScope(buttonScope, a.P) {
+				p.parseImpliedToken(StartTagToken, a.P, a.P.String())
+			}
+			p.popUntil(buttonScope, a.P)
+		case a.Li:
+			p.popUntil(listItemScope, a.Li)
+		case a.Dd, a.Dt:
+			p.popUntil(defaultScope, p.tok.DataAtom)
+		case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
+			p.popUntil(defaultScope, a.H1, a.H2, a.H3, a.H4, a.H5, a.H6)
+		case a.A, a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.Nobr, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U:
+			p.inBodyEndTagFormatting(p.tok.DataAtom)
+		case a.Applet, a.Marquee, a.Object:
+			if p.popUntil(defaultScope, p.tok.DataAtom) {
+				p.clearActiveFormattingElements()
+			}
+		case a.Br:
+			p.tok.Type = StartTagToken
+			return false
+		default:
+			p.inBodyEndTagOther(p.tok.DataAtom)
+		}
+	case CommentToken:
+		p.addChild(&Node{
+			Type: CommentNode,
+			Data: p.tok.Data,
+		})
+	}
+
+	return true
+}
+
+func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) {
+	// This is the "adoption agency" algorithm, described at
+	// https://html.spec.whatwg.org/multipage/syntax.html#adoptionAgency
+
+	// TODO: this is a fairly literal line-by-line translation of that algorithm.
+	// Once the code successfully parses the comprehensive test suite, we should
+	// refactor this code to be more idiomatic.
+
+	// Steps 1-4. The outer loop.
+	for i := 0; i < 8; i++ {
+		// Step 5. Find the formatting element.
+		var formattingElement *Node
+		for j := len(p.afe) - 1; j >= 0; j-- {
+			if p.afe[j].Type == scopeMarkerNode {
+				break
+			}
+			if p.afe[j].DataAtom == tagAtom {
+				formattingElement = p.afe[j]
+				break
+			}
+		}
+		if formattingElement == nil {
+			p.inBodyEndTagOther(tagAtom)
+			return
+		}
+		feIndex := p.oe.index(formattingElement)
+		if feIndex == -1 {
+			p.afe.remove(formattingElement)
+			return
+		}
+		if !p.elementInScope(defaultScope, tagAtom) {
+			// Ignore the tag.
+			return
+		}
+
+		// Steps 9-10. Find the furthest block.
+		var furthestBlock *Node
+		for _, e := range p.oe[feIndex:] {
+			if isSpecialElement(e) {
+				furthestBlock = e
+				break
+			}
+		}
+		if furthestBlock == nil {
+			e := p.oe.pop()
+			for e != formattingElement {
+				e = p.oe.pop()
+			}
+			p.afe.remove(e)
+			return
+		}
+
+		// Steps 11-12. Find the common ancestor and bookmark node.
+		commonAncestor := p.oe[feIndex-1]
+		bookmark := p.afe.index(formattingElement)
+
+		// Step 13. The inner loop. Find the lastNode to reparent.
+		lastNode := furthestBlock
+		node := furthestBlock
+		x := p.oe.index(node)
+		// Steps 13.1-13.2
+		for j := 0; j < 3; j++ {
+			// Step 13.3.
+			x--
+			node = p.oe[x]
+			// Step 13.4 - 13.5.
+			if p.afe.index(node) == -1 {
+				p.oe.remove(node)
+				continue
+			}
+			// Step 13.6.
+			if node == formattingElement {
+				break
+			}
+			// Step 13.7.
+			clone := node.clone()
+			p.afe[p.afe.index(node)] = clone
+			p.oe[p.oe.index(node)] = clone
+			node = clone
+			// Step 13.8.
+			if lastNode == furthestBlock {
+				bookmark = p.afe.index(node) + 1
+			}
+			// Step 13.9.
+			if lastNode.Parent != nil {
+				lastNode.Parent.RemoveChild(lastNode)
+			}
+			node.AppendChild(lastNode)
+			// Step 13.10.
+			lastNode = node
+		}
+
+		// Step 14. Reparent lastNode to the common ancestor,
+		// or for misnested table nodes, to the foster parent.
+		if lastNode.Parent != nil {
+			lastNode.Parent.RemoveChild(lastNode)
+		}
+		switch commonAncestor.DataAtom {
+		case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
+			p.fosterParent(lastNode)
+		default:
+			commonAncestor.AppendChild(lastNode)
+		}
+
+		// Steps 15-17. Reparent nodes from the furthest block's children
+		// to a clone of the formatting element.
+		clone := formattingElement.clone()
+		reparentChildren(clone, furthestBlock)
+		furthestBlock.AppendChild(clone)
+
+		// Step 18. Fix up the list of active formatting elements.
+		if oldLoc := p.afe.index(formattingElement); oldLoc != -1 && oldLoc < bookmark {
+			// Move the bookmark with the rest of the list.
+			bookmark--
+		}
+		p.afe.remove(formattingElement)
+		p.afe.insert(bookmark, clone)
+
+		// Step 19. Fix up the stack of open elements.
+		p.oe.remove(formattingElement)
+		p.oe.insert(p.oe.index(furthestBlock)+1, clone)
+	}
+}
+
+// inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM.
+// "Any other end tag" handling from 12.2.5.5 The rules for parsing tokens in foreign content
+// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign
+func (p *parser) inBodyEndTagOther(tagAtom a.Atom) {
+	for i := len(p.oe) - 1; i >= 0; i-- {
+		if p.oe[i].DataAtom == tagAtom {
+			p.oe = p.oe[:i]
+			break
+		}
+		if isSpecialElement(p.oe[i]) {
+			break
+		}
+	}
+}
+
+// Section 12.2.5.4.8.
+func textIM(p *parser) bool {
+	switch p.tok.Type {
+	case ErrorToken:
+		p.oe.pop()
+	case TextToken:
+		d := p.tok.Data
+		if n := p.oe.top(); n.DataAtom == a.Textarea && n.FirstChild == nil {
+			// Ignore a newline at the start of a